-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add integration test for SSA updating empty labels/annotations
- Loading branch information
Showing
5 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/sdk/nodejs/server-side-apply-empty-maps/configmap/Pulumi.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: server-side-apply-empty-maps-tests | ||
description: Tests Server-side Apply support with proper handling of empty map fields | ||
runtime: nodejs |
35 changes: 35 additions & 0 deletions
35
tests/sdk/nodejs/server-side-apply-empty-maps/configmap/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2016-2022, Pulumi Corporation. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import * as k8s from "@pulumi/kubernetes"; | ||
|
||
// This test creates a Provider with `enableServerSideApply` enabled. The following scenarios are tested: | ||
// 1. Create a namespace and ConfigMap with pulumi. | ||
// 2. Externally delete labels in the ConfigMap using kubectl. | ||
// 3. Rerun the pulumi program and verify that the labels are restored. | ||
|
||
// Create provider with SSA enabled. | ||
const provider = new k8s.Provider("k8s", {enableServerSideApply: true}); | ||
|
||
// Create a randomly-named Namespace. | ||
const ns = new k8s.core.v1.Namespace("test", undefined, {provider}); | ||
|
||
export const cm = new k8s.core.v1.ConfigMap("test", { | ||
metadata: { | ||
name: "foo", | ||
namespace: ns.metadata.name, | ||
labels: {foo: "bar"}, // This is the field of interest. | ||
}, | ||
data: {dataKey: "fake data"}, | ||
}, {provider}); |
11 changes: 11 additions & 0 deletions
11
tests/sdk/nodejs/server-side-apply-empty-maps/configmap/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "server-side-apply-empty-maps", | ||
"version": "0.1.0", | ||
"dependencies": { | ||
"@pulumi/pulumi": "latest", | ||
"@pulumi/random": "latest" | ||
}, | ||
"peerDependencies": { | ||
"@pulumi/kubernetes": "latest" | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/sdk/nodejs/server-side-apply-empty-maps/configmap/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "bin", | ||
"target": "es6", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"stripInternal": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strictNullChecks": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} | ||
|