Skip to content
Snippets Groups Projects
Verified Commit bdb422a0 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: fixing test cases #57

parent 7e4fb73e
No related branches found
No related tags found
No related merge requests found
......@@ -6,18 +6,9 @@
<component name="ChangeListManager">
<list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-1_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-1_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-2_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-2_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-3_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-3_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-4_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-4_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-5_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-5_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-7_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-7_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-8_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-8_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database.go" beforeDir="false" afterPath="$PROJECT_DIR$/database.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/job-syncer.go" beforeDir="false" afterPath="$PROJECT_DIR$/job-syncer.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/job-syncer_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/job-syncer_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/go-task.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/go-task.nix" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database-6_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-6_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/issue-1_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/issue-1_test.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/manager.go" beforeDir="false" afterPath="$PROJECT_DIR$/manager.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/nix/scripts/run-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-tests.nix" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
......@@ -58,11 +49,13 @@
"DefaultGoTemplateProperty": "Go File",
"Go Test.TestDummyRunnable in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestResetStats in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestRoundTrip in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestScheduleJob in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestStructure in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestTimeFunctionSame in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestWriteToDB1 in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestWriteToDB2 in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.TestWriteToDB4 in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"Go Test.go test gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.go.formatter.settings.were.checked": "true",
......@@ -90,7 +83,7 @@
<recent name="$PROJECT_DIR$/.back" />
</key>
</component>
<component name="RunManager" selected="Go Test.TestWriteToDB1 in gitlab.schukai.com/oss/libraries/go/services/job-queues">
<component name="RunManager" selected="Go Test.TestRoundTrip in gitlab.schukai.com/oss/libraries/go/services/job-queues">
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="job-queues" />
<working_directory value="$PROJECT_DIR$" />
......@@ -111,7 +104,7 @@
<pattern value="^\QTestDummyRunnable\E$" />
<method v="2" />
</configuration>
<configuration name="TestResetStats in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
<configuration name="TestRoundTrip in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
<module name="job-queues" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
......@@ -119,7 +112,7 @@
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
<pattern value="^\QTestResetStats\E$" />
<pattern value="^\QTestRoundTrip\E$" />
<method v="2" />
</configuration>
<configuration name="TestWriteToDB1 in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
......@@ -144,21 +137,22 @@
<pattern value="^\QTestWriteToDB2\E$" />
<method v="2" />
</configuration>
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
<configuration name="TestWriteToDB4 in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
<module name="job-queues" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-i" />
<kind />
<kind value="PACKAGE" />
<package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
<pattern value="^\QTestWriteToDB4\E$" />
<method v="2" />
</configuration>
<configuration name="go test gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="job-queues" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<go_parameters value="-i" />
<kind />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
......@@ -166,11 +160,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Go Test.TestRoundTrip in gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<item itemvalue="Go Test.TestWriteToDB4 in gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<item itemvalue="Go Test.TestWriteToDB1 in gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<item itemvalue="Go Test.TestWriteToDB2 in gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<item itemvalue="Go Test.TestDummyRunnable in gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<item itemvalue="Go Test.go test gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<item itemvalue="Go Test.TestResetStats in gitlab.schukai.com/oss/libraries/go/services/job-queues" />
</list>
</recent_temporary>
</component>
......@@ -206,7 +200,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/database-2_test.go</url>
<line>25</line>
<line>32</line>
<option name="timeStamp" value="20" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
......@@ -214,6 +208,11 @@
<line>70</line>
<option name="timeStamp" value="21" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/job-syncer.go</url>
<line>62</line>
<option name="timeStamp" value="23" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
......
......@@ -18,7 +18,7 @@ func TestWriteToDB6(t *testing.T) {
// it is necessary to have a running mysql server
// docker rm -f mysql-test && \
// docker run --name mysql-test -e MYSQL_ROOT_PASSWORD=my-secret-pw -e MYSQL_DATABASE=testdb -p 3306:3306 -d mysql:latest && \
// docker logs -f mysql-test
// docker logs -f mysql-test
//dsn := "root:my-secret-pw@tcp(localhost:3306)/testdb?charset=utf8mb4&parseTime=True&loc=Local"
//db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
......
......@@ -16,7 +16,7 @@ import (
)
// TestRoundTrip tests the round trip of jobs from yaml to the manager and back to yaml
// This test runs forever and must be stopped manually
// This test runs forever and must be stopped manually. this test run without database
// Use the following command to run this test:
// go test -timeout 6h -run TestRoundTrip -v
func TestRoundTrip(t *testing.T) {
......@@ -63,6 +63,8 @@ func TestRoundTrip(t *testing.T) {
var err error
t.Log("This test runs forever and must be stopped manually")
cronInstance := cron.New(cron.WithSeconds())
cronInstance.Start()
......
......@@ -467,7 +467,7 @@ func (m *Manager) Start() error {
return ErrManagerAlreadyRunning
}
if m.jobSyncer == nil {
if m.jobSyncer == nil && m.database != nil {
m.jobSyncer = NewJobSyncer(m)
}
......
......@@ -13,7 +13,7 @@
- rt
env:
TEST_BY_TASK: true
USER_WORKING_DIR: "{{.USER_WORKING_DIR}}"
USER_WORKING_DIR: "{{.USER_WORKING_DIR}}"
cmds:
- run-tests
silent: true
......
......@@ -24,7 +24,7 @@ in
if [[ "$selection" == "run all tests" ]]; then
echo_ok "Running all tests"
if ! ${pkgs.go}/bin/go test -v -failfast ./...
if ! ${pkgs.go}/bin/go test -tags runOnTask -v -failfast ./...
then
echo_fail "ERROR: Tests failed, check your Go!"
exit 1
......@@ -52,8 +52,8 @@ in
echo_ok "No tests selected, exiting."
exit 0
fi
if ! ${pkgs.go}/bin/go test -run "$(echo $selected_tests | tr '\n' "")"
if ! ${pkgs.go}/bin/go test -tags runOnTask -run "$(echo $selected_tests)"
then
echo_fail "ERROR: Tests failed, check your Go!"
exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment