From fd738ec293fd0fb69c5e30b1112a97e263a5742f Mon Sep 17 00:00:00 2001 From: Sean Shahkarami Date: Mon, 6 Jun 2022 17:22:02 -0500 Subject: [PATCH] added support for latest tag --- main.go | 2 ++ worker_test.go | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/main.go b/main.go index 18d52bc..542f2c5 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,9 @@ const timeShasumPattern = "[0-9]*-[0-9a-f]*" func scanForJobs(ctx context.Context, jobs chan<- Job, root string) error { patterns := []string{ filepath.Join(root, "node-*", "uploads", "*", versionPattern, timeShasumPattern, "data"), // uploads without a namespace + filepath.Join(root, "node-*", "uploads", "*", "latest", timeShasumPattern, "data"), // uploads without a namespace (latest tag) filepath.Join(root, "node-*", "uploads", "*", "*", versionPattern, timeShasumPattern, "data"), // uploads with a namespace + filepath.Join(root, "node-*", "uploads", "*", "*", "latest", timeShasumPattern, "data"), // uploads with a namespace (latest tag) } err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { diff --git a/worker_test.go b/worker_test.go index e031d82..ef3de0f 100644 --- a/worker_test.go +++ b/worker_test.go @@ -98,6 +98,18 @@ func TestScanAndProcess(t *testing.T) { data: []byte(`{"ts":1638576647406523064,"labels":{"filename":"wow1.txt"}}`), }, }, + "Latest": { + { + path: "node-000048b02d15bc7c/uploads/Pluginctl/imagesampler-top/latest/1638576647406523064-9801739daae44ec5293d4e1f53d3f4d2d426d91c/data", + upload: "node-data/Pluginctl/sage-imagesampler-top-latest/000048b02d15bc7c/1638576647406523064-wow1.txt", + data: []byte(`some more data`), + }, + { + path: "node-000048b02d15bc7c/uploads/Pluginctl/imagesampler-top/latest/1638576647406523064-9801739daae44ec5293d4e1f53d3f4d2d426d91c/meta", + upload: "node-data/Pluginctl/sage-imagesampler-top-latest/000048b02d15bc7c/1638576647406523064-wow1.txt.meta", + data: []byte(`{"ts":1638576647406523064,"labels":{"filename":"wow1.txt"}}`), + }, + }, "SkipNoData": { { path: "node-000048b02d15bc7c/uploads/Pluginctl/imagesampler-top/0.2.5/1638576647406523064-9801739daae44ec5293d4e1f53d3f4d2d426d91c/meta",