From 89e99a20a676869fe263a9e0535c4e9eb3e840b3 Mon Sep 17 00:00:00 2001 From: Cassandra Coyle Date: Tue, 1 Oct 2024 18:31:24 -0500 Subject: [PATCH 1/6] filepath -> path import Signed-off-by: Cassandra Coyle --- go.mod | 2 +- go.sum | 4 ++-- .../integration/suite/actors/reminders/scheduler/remove.go | 5 +++-- tests/integration/suite/daprd/jobs/remove.go | 6 +++--- .../suite/daprd/workflow/scheduler/deletereminder.go | 5 +++-- tests/integration/suite/scheduler/api/remove.go | 6 +++--- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 5640e9cde03..576ed3ab699 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/cloudevents/sdk-go/v2 v2.15.2 github.com/dapr/components-contrib v1.14.1-0.20240919155322-be7c19b742b1 github.com/dapr/kit v0.13.1-0.20240909215017-3823663aa4bb - github.com/diagridio/go-etcd-cron v0.2.3 + github.com/diagridio/go-etcd-cron v0.3.1-0.20241001200855-29030985eae8 github.com/evanphx/json-patch/v5 v5.9.0 github.com/go-chi/chi/v5 v5.0.11 github.com/go-chi/cors v1.2.1 diff --git a/go.sum b/go.sum index 5e10802ac8c..6bfc1231240 100644 --- a/go.sum +++ b/go.sum @@ -475,8 +475,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cu github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= -github.com/diagridio/go-etcd-cron v0.2.3 h1:HvB9zEd8eRvf5jnJxSKrDgY9qFeZLijzm5APCUD7J7Y= -github.com/diagridio/go-etcd-cron v0.2.3/go.mod h1:yYzzG6/Qgq4jlRi/ZIri2zgKkxhghxiA8u7a4Q7tIYQ= +github.com/diagridio/go-etcd-cron v0.3.1-0.20241001200855-29030985eae8 h1:GhQpbKFdNd8oGw3S2otAyiB8PqVn3anqzIypV4s7Sfo= +github.com/diagridio/go-etcd-cron v0.3.1-0.20241001200855-29030985eae8/go.mod h1:yYzzG6/Qgq4jlRi/ZIri2zgKkxhghxiA8u7a4Q7tIYQ= github.com/didip/tollbooth/v7 v7.0.1 h1:TkT4sBKoQoHQFPf7blQ54iHrZiTDnr8TceU+MulVAog= github.com/didip/tollbooth/v7 v7.0.1/go.mod h1:VZhDSGl5bDSPj4wPsih3PFa4Uh9Ghv8hgacaTm5PRT4= github.com/dimfeld/httptreemux v5.0.1+incompatible h1:Qj3gVcDNoOthBAqftuD596rm4wg/adLLz5xh5CmpiCA= diff --git a/tests/integration/suite/actors/reminders/scheduler/remove.go b/tests/integration/suite/actors/reminders/scheduler/remove.go index 63bec623c4f..fd45b61e93a 100644 --- a/tests/integration/suite/actors/reminders/scheduler/remove.go +++ b/tests/integration/suite/actors/reminders/scheduler/remove.go @@ -18,6 +18,7 @@ import ( "fmt" "net/http" "os" + "path" "path/filepath" "strconv" "sync/atomic" @@ -114,8 +115,8 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { DialTimeout: 5 * time.Second, }) - // Use "path/filepath" import, it is using OS specific path separator unlike "path" - etcdKeysPrefix := filepath.Join("dapr", "jobs") + // Use "path" import, to have the same path separator across OS + etcdKeysPrefix := path.Join("dapr", "jobs") assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) diff --git a/tests/integration/suite/daprd/jobs/remove.go b/tests/integration/suite/daprd/jobs/remove.go index c604fa4815b..98b144bedf2 100644 --- a/tests/integration/suite/daprd/jobs/remove.go +++ b/tests/integration/suite/daprd/jobs/remove.go @@ -16,7 +16,7 @@ package jobs import ( "context" "fmt" - "path/filepath" + "path" "strconv" "sync/atomic" "testing" @@ -94,8 +94,8 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { DialTimeout: 5 * time.Second, }) - // Use "path/filepath" import, it is using OS specific path separator unlike "path" - etcdKeysPrefix := filepath.Join("dapr", "jobs") + // Use "path" import, to have the same path separator across OS + etcdKeysPrefix := path.Join("dapr", "jobs") assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) diff --git a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go index d961ddbe902..6251397a5c5 100644 --- a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go +++ b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go @@ -17,6 +17,7 @@ import ( "context" "fmt" "os" + "path" "path/filepath" "testing" "time" @@ -87,8 +88,8 @@ func (d *deletereminder) Run(t *testing.T, ctx context.Context) { DialTimeout: 5 * time.Second, }) - // Use "path/filepath" import, it is using OS specific path separator unlike "path" - etcdKeysPrefix := filepath.Join("dapr", "jobs") + // Use "path" import, to have the same path separator across OS + etcdKeysPrefix := path.Join("dapr", "jobs") assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) diff --git a/tests/integration/suite/scheduler/api/remove.go b/tests/integration/suite/scheduler/api/remove.go index 50cc1aff9df..a9c10cd2d67 100644 --- a/tests/integration/suite/scheduler/api/remove.go +++ b/tests/integration/suite/scheduler/api/remove.go @@ -16,7 +16,7 @@ package api import ( "context" "fmt" - "path/filepath" + "path" "strconv" "testing" "time" @@ -104,8 +104,8 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { }) require.NoError(t, err) - // Use "path/filepath" import, it is using OS specific path separator unlike "path" - etcdKeysPrefix := filepath.Join("dapr", "jobs") + // Use "path" import, to have the same path separator across OS + etcdKeysPrefix := path.Join("dapr", "jobs") assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) From b5562cdf4ece9bc88440e0227f03e7d4fe042031 Mon Sep 17 00:00:00 2001 From: Cassandra Coyle Date: Wed, 2 Oct 2024 08:34:04 -0500 Subject: [PATCH 2/6] fix last test job key path Signed-off-by: Cassandra Coyle --- tests/integration/suite/scheduler/quorum/notls.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/integration/suite/scheduler/quorum/notls.go b/tests/integration/suite/scheduler/quorum/notls.go index 992248bf313..6766a5f6958 100644 --- a/tests/integration/suite/scheduler/quorum/notls.go +++ b/tests/integration/suite/scheduler/quorum/notls.go @@ -17,7 +17,7 @@ import ( "context" "fmt" "math/rand" - "runtime" + "path" "strconv" "testing" "time" @@ -147,12 +147,8 @@ func (n *notls) Run(t *testing.T, ctx context.Context) { func (n *notls) checkKeysForJobName(t *testing.T, jobName string, keys []*mvccpb.KeyValue) { t.Helper() - var jobPrefix string - if runtime.GOOS == "windows" { - jobPrefix = "dapr\\jobs\\app" - } else { - jobPrefix = "dapr/jobs/app" - } + // Use "path" import, to have the same path separator across OS + jobPrefix := path.Join("dapr", "jobs") found := false for _, kv := range keys { From fa94398ac64c4883518511629574cc5f63b58012 Mon Sep 17 00:00:00 2001 From: Cassandra Coyle Date: Wed, 2 Oct 2024 10:19:32 -0500 Subject: [PATCH 3/6] fix quorum/notls test Signed-off-by: Cassandra Coyle --- tests/integration/suite/scheduler/quorum/notls.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/suite/scheduler/quorum/notls.go b/tests/integration/suite/scheduler/quorum/notls.go index 6766a5f6958..3a8653fc135 100644 --- a/tests/integration/suite/scheduler/quorum/notls.go +++ b/tests/integration/suite/scheduler/quorum/notls.go @@ -148,8 +148,7 @@ func (n *notls) checkKeysForJobName(t *testing.T, jobName string, keys []*mvccpb t.Helper() // Use "path" import, to have the same path separator across OS - jobPrefix := path.Join("dapr", "jobs") - + jobPrefix := path.Join("dapr", "jobs", "app") found := false for _, kv := range keys { if string(kv.Key) == fmt.Sprintf("%s||%s||%s||%s", jobPrefix, "ns", "appid", jobName) { From 30e0e59057a023cae42ffc59cda7e3e782adf92c Mon Sep 17 00:00:00 2001 From: Cassie Coyle Date: Wed, 9 Oct 2024 09:56:36 -0500 Subject: [PATCH 4/6] Apply suggestions from code review Co-authored-by: Josh van Leeuwen Signed-off-by: Cassie Coyle --- tests/integration/suite/actors/reminders/scheduler/remove.go | 2 +- tests/integration/suite/daprd/jobs/remove.go | 2 +- .../suite/daprd/workflow/scheduler/deletereminder.go | 2 +- tests/integration/suite/scheduler/api/remove.go | 2 +- tests/integration/suite/scheduler/quorum/notls.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/suite/actors/reminders/scheduler/remove.go b/tests/integration/suite/actors/reminders/scheduler/remove.go index 22d08c5796a..59b5c6fcfef 100644 --- a/tests/integration/suite/actors/reminders/scheduler/remove.go +++ b/tests/integration/suite/actors/reminders/scheduler/remove.go @@ -116,7 +116,7 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { }) // Use "path" import, to have the same path separator across OS - etcdKeysPrefix := path.Join("dapr", "jobs") + etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) diff --git a/tests/integration/suite/daprd/jobs/remove.go b/tests/integration/suite/daprd/jobs/remove.go index 98b144bedf2..436009ac991 100644 --- a/tests/integration/suite/daprd/jobs/remove.go +++ b/tests/integration/suite/daprd/jobs/remove.go @@ -95,7 +95,7 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { }) // Use "path" import, to have the same path separator across OS - etcdKeysPrefix := path.Join("dapr", "jobs") + etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) diff --git a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go index a34ff5b7e8d..7e43b253306 100644 --- a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go +++ b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go @@ -89,7 +89,7 @@ func (d *deletereminder) Run(t *testing.T, ctx context.Context) { }) // Use "path" import, to have the same path separator across OS - etcdKeysPrefix := path.Join("dapr", "jobs") + etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) diff --git a/tests/integration/suite/scheduler/api/remove.go b/tests/integration/suite/scheduler/api/remove.go index a9c10cd2d67..c3b26b8d65c 100644 --- a/tests/integration/suite/scheduler/api/remove.go +++ b/tests/integration/suite/scheduler/api/remove.go @@ -105,7 +105,7 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { require.NoError(t, err) // Use "path" import, to have the same path separator across OS - etcdKeysPrefix := path.Join("dapr", "jobs") + etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix) diff --git a/tests/integration/suite/scheduler/quorum/notls.go b/tests/integration/suite/scheduler/quorum/notls.go index a7b5f1febeb..1c865f41044 100644 --- a/tests/integration/suite/scheduler/quorum/notls.go +++ b/tests/integration/suite/scheduler/quorum/notls.go @@ -148,7 +148,7 @@ func (n *notls) checkKeysForJobName(t *testing.T, jobName string, keys []*mvccpb t.Helper() // Use "path" import, to have the same path separator across OS - jobPrefix := path.Join("dapr", "jobs", "app") + jobPrefix := "dapr/jobs/app" found := false for _, kv := range keys { if string(kv.Key) == fmt.Sprintf("%s||%s||%s||%s", jobPrefix, "ns", "appid", jobName) { From 1f316d9bb87ecfc9f0fe11d71bc119b89d1f41ca Mon Sep 17 00:00:00 2001 From: Cassandra Coyle Date: Wed, 9 Oct 2024 15:02:49 -0400 Subject: [PATCH 5/6] rm unused import & fix e2e with deprecated field Signed-off-by: Cassandra Coyle --- tests/e2e/metrics/metrics_test.go | 4 ++-- tests/integration/suite/actors/reminders/scheduler/remove.go | 1 - tests/integration/suite/daprd/jobs/remove.go | 1 - .../suite/daprd/workflow/scheduler/deletereminder.go | 1 - tests/integration/suite/scheduler/api/remove.go | 1 - tests/integration/suite/scheduler/quorum/notls.go | 1 - 6 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/e2e/metrics/metrics_test.go b/tests/e2e/metrics/metrics_test.go index e2508a5d663..72eefe8675f 100644 --- a/tests/e2e/metrics/metrics_test.go +++ b/tests/e2e/metrics/metrics_test.go @@ -195,7 +195,7 @@ func testMetricDisabled(t *testing.T, app string, res *http.Response) { func findHTTPMetricFromPrometheus(t *testing.T, app string, res *http.Response) (foundMetric bool) { rfmt := expfmt.ResponseFormat(res.Header) - require.NotEqual(t, rfmt, expfmt.FmtUnknown) + require.NotEqual(t, rfmt, expfmt.TypeUnknown) decoder := expfmt.NewDecoder(res.Body, rfmt) @@ -277,7 +277,7 @@ func testGRPCMetrics(t *testing.T, app string, res *http.Response) { require.NotNil(t, res) rfmt := expfmt.ResponseFormat(res.Header) - require.NotEqual(t, rfmt, expfmt.FmtUnknown) + require.NotEqual(t, rfmt, expfmt.TypeUnknown) decoder := expfmt.NewDecoder(res.Body, rfmt) diff --git a/tests/integration/suite/actors/reminders/scheduler/remove.go b/tests/integration/suite/actors/reminders/scheduler/remove.go index 59b5c6fcfef..e52101e64ea 100644 --- a/tests/integration/suite/actors/reminders/scheduler/remove.go +++ b/tests/integration/suite/actors/reminders/scheduler/remove.go @@ -18,7 +18,6 @@ import ( "fmt" "net/http" "os" - "path" "path/filepath" "strconv" "sync/atomic" diff --git a/tests/integration/suite/daprd/jobs/remove.go b/tests/integration/suite/daprd/jobs/remove.go index 436009ac991..897d5b82ef5 100644 --- a/tests/integration/suite/daprd/jobs/remove.go +++ b/tests/integration/suite/daprd/jobs/remove.go @@ -16,7 +16,6 @@ package jobs import ( "context" "fmt" - "path" "strconv" "sync/atomic" "testing" diff --git a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go index 7e43b253306..262aa76e252 100644 --- a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go +++ b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go @@ -17,7 +17,6 @@ import ( "context" "fmt" "os" - "path" "path/filepath" "testing" "time" diff --git a/tests/integration/suite/scheduler/api/remove.go b/tests/integration/suite/scheduler/api/remove.go index c3b26b8d65c..52c6a9a68f1 100644 --- a/tests/integration/suite/scheduler/api/remove.go +++ b/tests/integration/suite/scheduler/api/remove.go @@ -16,7 +16,6 @@ package api import ( "context" "fmt" - "path" "strconv" "testing" "time" diff --git a/tests/integration/suite/scheduler/quorum/notls.go b/tests/integration/suite/scheduler/quorum/notls.go index 1c865f41044..7385bef6067 100644 --- a/tests/integration/suite/scheduler/quorum/notls.go +++ b/tests/integration/suite/scheduler/quorum/notls.go @@ -17,7 +17,6 @@ import ( "context" "fmt" "math/rand" - "path" "strconv" "testing" "time" From e581aa161f700404e9a01c126be8a70cc09c63e4 Mon Sep 17 00:00:00 2001 From: Cassandra Coyle Date: Thu, 10 Oct 2024 07:53:19 -0400 Subject: [PATCH 6/6] update comment Signed-off-by: Cassandra Coyle --- tests/integration/suite/actors/reminders/scheduler/remove.go | 2 +- tests/integration/suite/daprd/jobs/remove.go | 2 +- .../suite/daprd/workflow/scheduler/deletereminder.go | 2 +- tests/integration/suite/scheduler/api/remove.go | 2 +- tests/integration/suite/scheduler/quorum/notls.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/suite/actors/reminders/scheduler/remove.go b/tests/integration/suite/actors/reminders/scheduler/remove.go index e52101e64ea..31652cb2c83 100644 --- a/tests/integration/suite/actors/reminders/scheduler/remove.go +++ b/tests/integration/suite/actors/reminders/scheduler/remove.go @@ -114,7 +114,7 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { DialTimeout: 5 * time.Second, }) - // Use "path" import, to have the same path separator across OS + // should have the same path separator across OS etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { diff --git a/tests/integration/suite/daprd/jobs/remove.go b/tests/integration/suite/daprd/jobs/remove.go index 897d5b82ef5..5f3d1112303 100644 --- a/tests/integration/suite/daprd/jobs/remove.go +++ b/tests/integration/suite/daprd/jobs/remove.go @@ -93,7 +93,7 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { DialTimeout: 5 * time.Second, }) - // Use "path" import, to have the same path separator across OS + // should have the same path separator across OS etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { diff --git a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go index 262aa76e252..a03db7f634f 100644 --- a/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go +++ b/tests/integration/suite/daprd/workflow/scheduler/deletereminder.go @@ -87,7 +87,7 @@ func (d *deletereminder) Run(t *testing.T, ctx context.Context) { DialTimeout: 5 * time.Second, }) - // Use "path" import, to have the same path separator across OS + // should have the same path separator across OS etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { diff --git a/tests/integration/suite/scheduler/api/remove.go b/tests/integration/suite/scheduler/api/remove.go index 52c6a9a68f1..a0891d1af9c 100644 --- a/tests/integration/suite/scheduler/api/remove.go +++ b/tests/integration/suite/scheduler/api/remove.go @@ -103,7 +103,7 @@ func (r *remove) Run(t *testing.T, ctx context.Context) { }) require.NoError(t, err) - // Use "path" import, to have the same path separator across OS + // should have the same path separator across OS etcdKeysPrefix := "dapr/jobs" assert.EventuallyWithT(t, func(c *assert.CollectT) { diff --git a/tests/integration/suite/scheduler/quorum/notls.go b/tests/integration/suite/scheduler/quorum/notls.go index 7385bef6067..16e69d8e11f 100644 --- a/tests/integration/suite/scheduler/quorum/notls.go +++ b/tests/integration/suite/scheduler/quorum/notls.go @@ -146,7 +146,7 @@ func (n *notls) Run(t *testing.T, ctx context.Context) { func (n *notls) checkKeysForJobName(t *testing.T, jobName string, keys []*mvccpb.KeyValue) { t.Helper() - // Use "path" import, to have the same path separator across OS + // should have the same path separator across OS jobPrefix := "dapr/jobs/app" found := false for _, kv := range keys {