diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 969608d364db695cc9423ecceffe5d6e702c8bb8..ee08fac0b358d5c15e9a705b3f89d6e07b934ef6 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,20 +5,8 @@ </component> <component name="ChangeListManager"> <list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment=""> - <change beforePath="$PROJECT_DIR$/.gitlab-ci.yml" beforeDir="false" afterPath="$PROJECT_DIR$/.gitlab-ci.yml" 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-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-6_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database-6_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_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/database_test.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/common.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/common.nix" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/nix/scripts/deploy.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/deploy.nix" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/manager_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/manager_test.go" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -57,6 +45,7 @@ "keyToString": { "DefaultGoTemplateProperty": "Go File", "Go Test.TestDummyRunnable in gitlab.schukai.com/oss/libraries/go/services/job-queues.executor": "Debug", + "Go Test.TestManagerEventHandling 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", @@ -92,7 +81,7 @@ <recent name="$PROJECT_DIR$/.back" /> </key> </component> - <component name="RunManager" selected="Go Test.TestRoundTrip in gitlab.schukai.com/oss/libraries/go/services/job-queues"> + <component name="RunManager" selected="Go Test.TestManagerEventHandling 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$" /> @@ -102,7 +91,7 @@ <filePath value="$PROJECT_DIR$" /> <method v="2" /> </configuration> - <configuration name="TestDummyRunnable in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> + <configuration name="TestManagerEventHandling 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" /> @@ -110,7 +99,7 @@ <directory value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" /> <framework value="gotest" /> - <pattern value="^\QTestDummyRunnable\E$" /> + <pattern value="^\QTestManagerEventHandling\E$" /> <method v="2" /> </configuration> <configuration name="TestRoundTrip in gitlab.schukai.com/oss/libraries/go/services/job-queues" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true"> @@ -169,11 +158,11 @@ </configuration> <recent_temporary> <list> + <item itemvalue="Go Test.TestManagerEventHandling in gitlab.schukai.com/oss/libraries/go/services/job-queues" /> <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" /> </list> </recent_temporary> </component> diff --git a/manager_test.go b/manager_test.go index 525891c28fec90a818026299bfc08b752c1ce62c..5bb93ddaa022dc6b1eaccd00212a85c8bdc6187a 100644 --- a/manager_test.go +++ b/manager_test.go @@ -246,7 +246,7 @@ func TestManagerEventHandling(t *testing.T) { runner := &CounterRunnable{} job := NewJob[CounterResult]("job1", runner) - scheduler := &IntervalScheduler{Interval: 1 * time.Millisecond} + scheduler := &IntervalScheduler{Interval: 2 * time.Millisecond} err = mgr.ScheduleJob(job, scheduler) assert.Nil(t, err) @@ -260,11 +260,12 @@ func TestManagerEventHandling(t *testing.T) { time.Sleep(2 * time.Millisecond) - if time.Since(startTime) > 1*time.Second { + if time.Since(startTime) > 100*time.Millisecond { t.Fatalf("Job did not finish in time") } } + time.Sleep(2 * time.Millisecond) err = mgr.Stop() assert.Nil(t, err) }