Skip to content

Commit 2705250

Browse files
committed
Add test coverage for node_pool metadata
1 parent 103bb7c commit 2705250

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash -e
2+
3+
kubectl --kubeconfig=/var/lib/kubelet/kubeconfig drain --force=true --ignore-daemonsets=true --delete-local-data "$HOSTNAME"

examples/node_pool/main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ module "gke" {
5555
},
5656
]
5757

58+
node_pools_metadata = {
59+
all = {}
60+
61+
pool-01 = {
62+
shutdown-script = "${file("${path.module}/data/shutdown-script.sh")}"
63+
}
64+
65+
pool-02 = {}
66+
}
67+
5868
node_pools_labels = {
5969
all = {
6070
all-pools-example = "true"

test/integration/node_pool/controls/gcloud.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@
104104
)
105105
end
106106

107+
it "has the expected metadata" do
108+
expect(data['nodePools']).to include(
109+
including(
110+
"name" => "pool-01",
111+
"config" => including(
112+
"metadata" => including(
113+
"shutdown-script" => File.open("examples/node_pool/data/shutdown-script.sh").read,
114+
),
115+
),
116+
)
117+
)
118+
end
119+
107120
it "has the expected labels" do
108121
expect(data['nodePools']).to include(
109122
including(

0 commit comments

Comments
 (0)