Skip to content

Commit

Permalink
Add integration test for patch
Browse files Browse the repository at this point in the history
  • Loading branch information
rquitales committed Aug 24, 2023
1 parent a42046b commit 40c039a
Show file tree
Hide file tree
Showing 8 changed files with 1,533 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/examples_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ func TestAccEnvironmentTs(t *testing.T) {
integration.ProgramTest(t, &test)
}

// TestKafkaTopicPatch tests that upstream patches to add in the deprecated httpEndpoint field works as expected.
func TestKafkaTopicPatch(t *testing.T) {
test := getJSBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: path.Join(getCwd(t), "kafka-topic-patch", "ts", "step1"),
EditDirs: []integration.EditDir{
{
Dir: path.Join(getCwd(t), "kafka-topic-patch", "ts", "step2"),
Additive: true,
},
},
})

integration.ProgramTest(t, &test)
}

func getJSBaseOptions(t *testing.T) integration.ProgramTestOptions {
base := getBaseOptions()
baseJS := base.With(integration.ProgramTestOptions{
Expand Down
2 changes: 2 additions & 0 deletions examples/kafka-topic-patch/ts/step1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
/node_modules/
3 changes: 3 additions & 0 deletions examples/kafka-topic-patch/ts/step1/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: confluentcloud-ts-patch
runtime: nodejs
description: A minimal TypeScript Pulumi program
22 changes: 22 additions & 0 deletions examples/kafka-topic-patch/ts/step1/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as pulumi from "@pulumi/pulumi";
import * as confluent from "@pulumi/confluentcloud";

const env = new confluent.Environment("ts-env");

const kfCluster = new confluent.KafkaCluster("kfCluster", {
cloud: "AWS",
region: "us-west-2",
availability: "SINGLE_ZONE",
environment: {
id: env.id,
},
});

const kfTopic = new confluent.KafkaTopic("kfTopic", {
topicName: "test-topic",
kafkaCluster: {
id: kfCluster.id,
},
// Deprecated field which we are still supporting.
httpEndpoint: kfCluster.restEndpoint,
});
1,431 changes: 1,431 additions & 0 deletions examples/kafka-topic-patch/ts/step1/package-lock.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions examples/kafka-topic-patch/ts/step1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "confluentcloud-ts-environment",
"devDependencies": {
"@types/node": "^14"
},
"dependencies": {
"@pulumi/pulumi": "^3.73.0",
"@pulumi/random": "^4.0.0"
}
}
18 changes: 18 additions & 0 deletions examples/kafka-topic-patch/ts/step1/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.ts"
]
}
31 changes: 31 additions & 0 deletions examples/kafka-topic-patch/ts/step2/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as pulumi from "@pulumi/pulumi";
import * as confluent from "@pulumi/confluentcloud";

const env = new confluent.Environment("ts-env");

const kfCluster = new confluent.KafkaCluster("kfCluster", {
cloud: "AWS",
region: "us-west-2",
availability: "SINGLE_ZONE",
environment: {
id: env.id,
},
});

const kfTopic = new confluent.KafkaTopic("kfTopic", {
topicName: "test-topic",
kafkaCluster: {
id: kfCluster.id,
},
// Deprecated field which we are still supporting.
httpEndpoint: kfCluster.restEndpoint,
});

const res = kfCluster.restEndpoint.apply((endPt) => {
const res = confluent.getKafkaTopic({
topicName: "test-topic",
restEndpoint: endPt,
});

return res;
});

0 comments on commit 40c039a

Please sign in to comment.