Skip to content

Commit

Permalink
Merge pull request dapr#8158 from cicoyle/fix-jobs-key-path
Browse files Browse the repository at this point in the history
Fix Jobs Key Path to Not be OS Specific
  • Loading branch information
JoshVanL authored Oct 14, 2024
2 parents 78e5cfd + db5c132 commit 5e3feae
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/cloudevents/sdk-go/v2 v2.15.2
github.com/dapr/components-contrib v1.14.1-0.20241010135037-69119d6f6ccf
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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,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=
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/suite/actors/reminders/scheduler/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,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")
// should have the same path separator across OS
etcdKeysPrefix := "dapr/jobs"

assert.EventuallyWithT(t, func(c *assert.CollectT) {
keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix)
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/suite/daprd/jobs/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package jobs
import (
"context"
"fmt"
"path/filepath"
"strconv"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -94,8 +93,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")
// should have the same path separator across OS
etcdKeysPrefix := "dapr/jobs"

assert.EventuallyWithT(t, func(c *assert.CollectT) {
keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,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")
// should have the same path separator across OS
etcdKeysPrefix := "dapr/jobs"

assert.EventuallyWithT(t, func(c *assert.CollectT) {
keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix)
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/suite/scheduler/api/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package api
import (
"context"
"fmt"
"path/filepath"
"strconv"
"testing"
"time"
Expand Down Expand Up @@ -104,8 +103,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")
// should have the same path separator across OS
etcdKeysPrefix := "dapr/jobs"

assert.EventuallyWithT(t, func(c *assert.CollectT) {
keys, rerr := etcdClient.ListAllKeys(ctx, etcdKeysPrefix)
Expand Down
10 changes: 2 additions & 8 deletions tests/integration/suite/scheduler/quorum/notls.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"context"
"fmt"
"math/rand"
"runtime"
"strconv"
"testing"
"time"
Expand Down Expand Up @@ -147,13 +146,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"
}

// should have the same path separator across OS
jobPrefix := "dapr/jobs/app"
found := false
for _, kv := range keys {
if string(kv.Key) == fmt.Sprintf("%s||%s||%s||%s", jobPrefix, "ns", "appid", jobName) {
Expand Down

0 comments on commit 5e3feae

Please sign in to comment.