diff --git a/cmd/internal/exec.go b/cmd/internal/exec.go index 58ff5a1..38f7399 100644 --- a/cmd/internal/exec.go +++ b/cmd/internal/exec.go @@ -145,7 +145,7 @@ func execFunc(ctx *context.Context, cmd *cobra.Command, verb executable.Verb, ar logger.FatalErr(err) } dur := time.Since(startTime) - processStore, err := store.NewStore(true) + processStore, err := store.NewStore() if err != nil { logger.Errorf("failed clearing process store\n%v", err) } diff --git a/internal/runner/parallel/parallel.go b/internal/runner/parallel/parallel.go index 6a482f1..f9343a4 100644 --- a/internal/runner/parallel/parallel.go +++ b/internal/runner/parallel/parallel.go @@ -52,6 +52,9 @@ func (r *parallelRunner) Exec( return err } defer str.Close() + if err := str.CreateBucket(store.EnvironmentBucket()); err != nil { + return err + } return handleExec(ctx, e, eng, parallelSpec, inputEnv, str) } @@ -73,9 +76,6 @@ func handleExec( } group.SetLimit(limit) - if err := str.CreateBucket(store.EnvironmentBucket()); err != nil { - return err - } dm, err := str.GetAll() if err != nil { return err diff --git a/internal/runner/serial/serial.go b/internal/runner/serial/serial.go index b05e36a..e62fa54 100644 --- a/internal/runner/serial/serial.go +++ b/internal/runner/serial/serial.go @@ -52,6 +52,9 @@ func (r *serialRunner) Exec( return err } defer str.Close() + if err := str.CreateBucket(store.EnvironmentBucket()); err != nil { + return err + } return handleExec(ctx, e, eng, serialSpec, inputEnv, str) } return fmt.Errorf("no serial executables to run") @@ -65,9 +68,6 @@ func handleExec( promptedEnv map[string]string, str store.Store, ) error { - if err := str.CreateBucket(store.EnvironmentBucket()); err != nil { - return err - } dm, err := str.GetAll() if err != nil { return err diff --git a/internal/services/store/store_test.go b/internal/services/store/store_test.go index b1e561f..5901cf5 100644 --- a/internal/services/store/store_test.go +++ b/internal/services/store/store_test.go @@ -19,7 +19,7 @@ var _ = Describe("BoltStore", func() { var err error BeforeEach(func() { - s, err = store.NewStore(true) + s, err = store.NewStore() Expect(err).NotTo(HaveOccurred()) Expect(s).NotTo(BeNil()) }) @@ -161,25 +161,4 @@ var _ = Describe("BoltStore", func() { Expect(err).To(HaveOccurred()) }) }) - - Describe("GetAll", func() { - It("should get all key-value pairs from the bucket", func() { - err = store.SetProcessBucketID("process3", true) - err := s.CreateBucket() - Expect(err).NotTo(HaveOccurred()) - - err = s.Set("key1", "value1") - Expect(err).NotTo(HaveOccurred()) - - err = s.Set("key2", "value2") - Expect(err).NotTo(HaveOccurred()) - - data, err := s.GetAll() - Expect(err).NotTo(HaveOccurred()) - Expect(data).To(Equal(map[string]string{ - "key1": "value1", - "key2": "value2", - })) - }) - }) })