Skip to content

Commit

Permalink
Added support for pubsub namespace (via @elithrar in #1314)
Browse files Browse the repository at this point in the history
This adds support for managing pubsub namespaces and brokers (https://developers.cloudflare.com/pub-sub/)
  • Loading branch information
threepointone committed Jul 4, 2022
1 parent ff2e7cb commit f62ff97
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 463 deletions.
7 changes: 7 additions & 0 deletions .changeset/rude-queens-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Added support for pubsub namespace (via @elithrar in https://github.com/cloudflare/wrangler2/pull/1314)

This adds support for managing pubsub namespaces and brokers (https://developers.cloudflare.com/pub-sub/)
18 changes: 9 additions & 9 deletions packages/wrangler/src/__tests__/pubsub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("wrangler", () => {

it("should create a namespace", async () => {
const requests = mockCreateRequest("my-namespace");
await runWrangler("pubsub namespaces create my-namespace");
await runWrangler("pubsub namespace create my-namespace");
// TODO: check returned object
expect(requests.count).toEqual(1);
});
Expand All @@ -67,7 +67,7 @@ describe("wrangler", () => {
{ name: "namespace-2", created_on: "01-01-2001" },
];
const requests = mockListRequest(expectedNamespaces);
await runWrangler("pubsub namespaces list");
await runWrangler("pubsub namespace list");

expect(std.err).toMatchInlineSnapshot(`""`);
// TODO(elithrar): check returned object
Expand Down Expand Up @@ -97,7 +97,7 @@ describe("wrangler", () => {
it("should create a broker", async () => {
const requests = mockCreateRequest("my-broker");
await runWrangler(
"pubsub brokers create my-broker --namespace=some-namespace"
"pubsub broker create my-broker --namespace=some-namespace"
);

// TODO: check returned object
Expand All @@ -106,7 +106,7 @@ describe("wrangler", () => {

it("fail to create broker when no namespace is set", async () => {
await expect(
runWrangler("pubsub brokers create my-broker")
runWrangler("pubsub broker create my-broker")
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Missing required argument: namespace"`
);
Expand Down Expand Up @@ -151,7 +151,7 @@ describe("wrangler", () => {
expectedOnPublish
);
await runWrangler(
"pubsub brokers update my-broker --namespace=some-namespace --expiration=24h --description='hello' --on-publish-url='https://foo.bar.example.com'"
"pubsub broker update my-broker --namespace=some-namespace --expiration=24h --description='hello' --on-publish-url='https://foo.bar.example.com'"
);

expect(std.err).toMatchInlineSnapshot(`""`);
Expand Down Expand Up @@ -182,7 +182,7 @@ describe("wrangler", () => {
{ name: "broker-2", created_on: "01-01-2001" },
];
const requests = mockListRequest(expectedBrokers);
await runWrangler("pubsub brokers list --namespace=some-namespace");
await runWrangler("pubsub broker list --namespace=some-namespace");

expect(std.err).toMatchInlineSnapshot(`""`);
// TODO(elithrar): check returned object
Expand All @@ -209,7 +209,7 @@ describe("wrangler", () => {
it("should describe a single broker", async () => {
const requests = mockGetRequest({ id: "1234", name: "my-broker" });
await runWrangler(
"pubsub brokers describe my-broker --namespace=some-namespace"
"pubsub broker describe my-broker --namespace=some-namespace"
);

expect(std.err).toMatchInlineSnapshot(`""`);
Expand All @@ -236,7 +236,7 @@ describe("wrangler", () => {
it("should issue a token for the broker", async () => {
const requests = mockIssueRequest("my-broker");
await runWrangler(
"pubsub brokers issue my-broker --namespace=some-namespace"
"pubsub broker issue my-broker --namespace=some-namespace"
);

expect(std.err).toMatchInlineSnapshot(`""`);
Expand All @@ -263,7 +263,7 @@ describe("wrangler", () => {
it("should return the public keys for a broker", async () => {
const requests = mockIssueRequest("my-broker");
await runWrangler(
"pubsub brokers public-keys my-broker --namespace=some-namespace"
"pubsub broker public-keys my-broker --namespace=some-namespace"
);

expect(std.err).toMatchInlineSnapshot(`""`);
Expand Down
Loading

0 comments on commit f62ff97

Please sign in to comment.