You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/wrangler/src/__tests__/r2.test.ts
+244Lines changed: 244 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -157,6 +157,7 @@ describe("r2", () => {
157
157
wrangler r2 bucket info <bucket> Get information about an R2 bucket
158
158
wrangler r2 bucket delete <bucket> Delete an R2 bucket
159
159
wrangler r2 bucket sippy Manage Sippy incremental migration on an R2 bucket
160
+
wrangler r2 bucket catalog Manage the data catalog for your R2 buckets - provides an Iceberg REST interface for query engines like Spark, DuckDB, and Trino [open-beta]
160
161
wrangler r2 bucket notification Manage event notification rules for an R2 bucket
161
162
wrangler r2 bucket domain Manage custom domains for an R2 bucket
162
163
wrangler r2 bucket dev-url Manage public access via the r2.dev URL for an R2 bucket
@@ -197,6 +198,7 @@ describe("r2", () => {
197
198
wrangler r2 bucket info <bucket> Get information about an R2 bucket
198
199
wrangler r2 bucket delete <bucket> Delete an R2 bucket
199
200
wrangler r2 bucket sippy Manage Sippy incremental migration on an R2 bucket
201
+
wrangler r2 bucket catalog Manage the data catalog for your R2 buckets - provides an Iceberg REST interface for query engines like Spark, DuckDB, and Trino [open-beta]
200
202
wrangler r2 bucket notification Manage event notification rules for an R2 bucket
201
203
wrangler r2 bucket domain Manage custom domains for an R2 bucket
202
204
wrangler r2 bucket dev-url Manage public access via the r2.dev URL for an R2 bucket
@@ -929,6 +931,248 @@ describe("r2", () => {
929
931
});
930
932
});
931
933
934
+
describe("catalog",()=>{
935
+
it("should show the correct help when an invalid command is passed",async()=>{
Use this Catalog URI with Iceberg-compatible query engines (Spark, DuckDB, Trino, etc.) to query data as tables.
992
+
Note: You'll need a Cloudflare API token with 'R2 Data Catalog' permission to authenticate your client with this catalog.
993
+
For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/"`
994
+
);
995
+
});
996
+
997
+
it("should error if no bucket name is given",async()=>{
998
+
awaitexpect(
999
+
runWrangler("r2 bucket catalog enable")
1000
+
).rejects.toThrowErrorMatchingInlineSnapshot(
1001
+
`[Error: Not enough non-option arguments: got 0, need at least 1]`
1002
+
);
1003
+
expect(std.out).toMatchInlineSnapshot(`
1004
+
"
1005
+
wrangler r2 bucket catalog enable <bucket>
1006
+
1007
+
Enable the data catalog on an R2 bucket [open-beta]
1008
+
1009
+
POSITIONALS
1010
+
bucket The name of the bucket to enable [string] [required]
1011
+
1012
+
GLOBAL FLAGS
1013
+
-c, --config Path to Wrangler configuration file [string]
1014
+
--cwd Run as if Wrangler was started in the specified directory instead of the current working directory [string]
1015
+
-e, --env Environment to use for operations, and for selecting .env and .dev.vars files [string]
1016
+
-h, --help Show help [boolean]
1017
+
-v, --version Show version number [boolean]"
1018
+
`);
1019
+
expect(std.err).toMatchInlineSnapshot(`
1020
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough non-option arguments: got 0, need at least 1[0m
1021
+
1022
+
"
1023
+
`);
1024
+
});
1025
+
});
1026
+
1027
+
describe("disable",()=>{
1028
+
const{ setIsTTY }=useMockIsTTY();
1029
+
it("should error if no bucket name is given",async()=>{
1030
+
awaitexpect(
1031
+
runWrangler("r2 bucket catalog disable")
1032
+
).rejects.toThrowErrorMatchingInlineSnapshot(
1033
+
`[Error: Not enough non-option arguments: got 0, need at least 1]`
1034
+
);
1035
+
expect(std.out).toMatchInlineSnapshot(`
1036
+
"
1037
+
wrangler r2 bucket catalog disable <bucket>
1038
+
1039
+
Disable the data catalog for an R2 bucket [open-beta]
1040
+
1041
+
POSITIONALS
1042
+
bucket The name of the bucket to disable the data catalog for [string] [required]
1043
+
1044
+
GLOBAL FLAGS
1045
+
-c, --config Path to Wrangler configuration file [string]
1046
+
--cwd Run as if Wrangler was started in the specified directory instead of the current working directory [string]
1047
+
-e, --env Environment to use for operations, and for selecting .env and .dev.vars files [string]
1048
+
-h, --help Show help [boolean]
1049
+
-v, --version Show version number [boolean]"
1050
+
`);
1051
+
expect(std.err).toMatchInlineSnapshot(`
1052
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough non-option arguments: got 0, need at least 1[0m
1053
+
1054
+
"
1055
+
`);
1056
+
});
1057
+
1058
+
it("should disable R2 catalog for the given bucket",async()=>{
1059
+
setIsTTY(true);
1060
+
mockConfirm({
1061
+
text: "Are you sure you want to disable the data catalog for bucket 'testBucket'? This action is irreversible, and you cannot re-enable it on this bucket.",
0 commit comments