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 @@ ...@@ -6,18 +6,9 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment=""> <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$/.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-6_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-6_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$/issue-1_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/issue-1_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$/manager.go" beforeDir="false" afterPath="$PROJECT_DIR$/manager.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$/nix/scripts/run-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-tests.nix" afterDir="false" /> <change beforePath="$PROJECT_DIR$/nix/scripts/run-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-tests.nix" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -58,11 +49,13 @@ ...@@ -58,11 +49,13 @@
"DefaultGoTemplateProperty": "Go File", "DefaultGoTemplateProperty": "Go File",
"Go Test.TestDummyRunnable in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", "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.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.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.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.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.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.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", "Go Test.go test gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug",
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.go.formatter.settings.were.checked": "true", "RunOnceActivity.go.formatter.settings.were.checked": "true",
...@@ -90,7 +83,7 @@ ...@@ -90,7 +83,7 @@
<recent name="$PROJECT_DIR$/.back" /> <recent name="$PROJECT_DIR$/.back" />
</key> </key>
</component> </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"> <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="job-queues" /> <module name="job-queues" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
...@@ -111,7 +104,7 @@ ...@@ -111,7 +104,7 @@
<pattern value="^\QTestDummyRunnable\E$" /> <pattern value="^\QTestDummyRunnable\E$" />
<method v="2" /> <method v="2" />
</configuration> </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" /> <module name="job-queues" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" /> <kind value="PACKAGE" />
...@@ -119,7 +112,7 @@ ...@@ -119,7 +112,7 @@
<directory value="$PROJECT_DIR$" /> <directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" />
<framework value="gotest" /> <framework value="gotest" />
<pattern value="^\QTestResetStats\E$" /> <pattern value="^\QTestRoundTrip\E$" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="TestWriteToDB1 in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> <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 @@ ...@@ -144,21 +137,22 @@
<pattern value="^\QTestWriteToDB2\E$" /> <pattern value="^\QTestWriteToDB2\E$" />
<method v="2" /> <method v="2" />
</configuration> </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" /> <module name="job-queues" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
<go_parameters value="-i" /> <kind value="PACKAGE" />
<kind /> <package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" />
<directory value="$PROJECT_DIR$" /> <directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" />
<framework value="gotest" /> <framework value="gotest" />
<pattern value="^\QTestWriteToDB4\E$" />
<method v="2" /> <method v="2" />
</configuration> </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" /> <module name="job-queues" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" /> <go_parameters value="-i" />
<package value="gitlab.schukai.com/oss/libraries/go/services/job-queues" /> <kind />
<directory value="$PROJECT_DIR$" /> <directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" />
<framework value="gotest" /> <framework value="gotest" />
...@@ -166,11 +160,11 @@ ...@@ -166,11 +160,11 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <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.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.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.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> </list>
</recent_temporary> </recent_temporary>
</component> </component>
...@@ -206,7 +200,7 @@ ...@@ -206,7 +200,7 @@
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/database-2_test.go</url> <url>file://$PROJECT_DIR$/database-2_test.go</url>
<line>25</line> <line>32</line>
<option name="timeStamp" value="20" /> <option name="timeStamp" value="20" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
...@@ -214,6 +208,11 @@ ...@@ -214,6 +208,11 @@
<line>70</line> <line>70</line>
<option name="timeStamp" value="21" /> <option name="timeStamp" value="21" />
</line-breakpoint> </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> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>
......
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
) )
// TestRoundTrip tests the round trip of jobs from yaml to the manager and back to yaml // 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: // Use the following command to run this test:
// go test -timeout 6h -run TestRoundTrip -v // go test -timeout 6h -run TestRoundTrip -v
func TestRoundTrip(t *testing.T) { func TestRoundTrip(t *testing.T) {
...@@ -63,6 +63,8 @@ func TestRoundTrip(t *testing.T) { ...@@ -63,6 +63,8 @@ func TestRoundTrip(t *testing.T) {
var err error var err error
t.Log("This test runs forever and must be stopped manually")
cronInstance := cron.New(cron.WithSeconds()) cronInstance := cron.New(cron.WithSeconds())
cronInstance.Start() cronInstance.Start()
......
...@@ -467,7 +467,7 @@ func (m *Manager) Start() error { ...@@ -467,7 +467,7 @@ func (m *Manager) Start() error {
return ErrManagerAlreadyRunning return ErrManagerAlreadyRunning
} }
if m.jobSyncer == nil { if m.jobSyncer == nil && m.database != nil {
m.jobSyncer = NewJobSyncer(m) m.jobSyncer = NewJobSyncer(m)
} }
......
...@@ -24,7 +24,7 @@ in ...@@ -24,7 +24,7 @@ in
if [[ "$selection" == "run all tests" ]]; then if [[ "$selection" == "run all tests" ]]; then
echo_ok "Running all tests" echo_ok "Running all tests"
if ! ${pkgs.go}/bin/go test -v -failfast ./... if ! ${pkgs.go}/bin/go test -tags runOnTask -v -failfast ./...
then then
echo_fail "ERROR: Tests failed, check your Go!" echo_fail "ERROR: Tests failed, check your Go!"
exit 1 exit 1
...@@ -53,7 +53,7 @@ in ...@@ -53,7 +53,7 @@ in
exit 0 exit 0
fi 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 then
echo_fail "ERROR: Tests failed, check your Go!" echo_fail "ERROR: Tests failed, check your Go!"
exit 1 exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment