From 5a0505a2c6c2969a7a6d69e4e02553047076e58e Mon Sep 17 00:00:00 2001 From: Spencer Schrock Date: Tue, 8 Nov 2022 16:40:34 -0800 Subject: [PATCH] Add tests to verify how List works with various prefixes Signed-off-by: Spencer Schrock --- cron/data/blob_test.go | 17 ++++++++++++++++- .../testdata/blob_test/subdir/nested/key5.txt | 0 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 cron/data/testdata/blob_test/subdir/nested/key5.txt diff --git a/cron/data/blob_test.go b/cron/data/blob_test.go index 205c7b47ffb..2c2121a5c50 100644 --- a/cron/data/blob_test.go +++ b/cron/data/blob_test.go @@ -128,11 +128,26 @@ func TestBlobKeysPrefix(t *testing.T) { { name: "no prefix", prefix: "", - want: []string{"key1.txt", "key2.txt", "key3.txt", "subdir/key4.txt"}, + want: []string{"key1.txt", "key2.txt", "key3.txt", "subdir/key4.txt", "subdir/nested/key5.txt"}, }, { name: "subdir prefix", prefix: "subdir/", + want: []string{"subdir/key4.txt", "subdir/nested/key5.txt"}, + }, + { + name: "subdir prefix no terminal slash", + prefix: "subdir", + want: []string{"subdir/key4.txt", "subdir/nested/key5.txt"}, + }, + { + name: "nested prefix", + prefix: "subdir/nested/", + want: []string{"subdir/nested/key5.txt"}, + }, + { + name: "file prefix", + prefix: "subdir/key4.txt", want: []string{"subdir/key4.txt"}, }, } diff --git a/cron/data/testdata/blob_test/subdir/nested/key5.txt b/cron/data/testdata/blob_test/subdir/nested/key5.txt new file mode 100644 index 00000000000..e69de29bb2d