@@ -18,7 +18,7 @@ teardown() {
18
18
build_name=$( random_name)
19
19
20
20
# create a Build with node selector
21
- run shp build create ${build_name} --source-url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image --node=" kubernetes.io/hostname=node-1"
21
+ run shp build create ${build_name} --source-git- url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image --node-selector =" kubernetes.io/hostname=node-1"
22
22
assert_success
23
23
24
24
# ensure that the build was successfully created
@@ -36,7 +36,7 @@ teardown() {
36
36
build_name=$( random_name)
37
37
38
38
# create a Build with node selector
39
- run shp build create ${build_name} --source-url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image --node=" kubernetes.io/hostname=node-1" --node=" kubernetes.io/os=linux"
39
+ run shp build create ${build_name} --source-git- url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image --node-selector =" kubernetes.io/hostname=node-1" --node-selector =" kubernetes.io/os=linux"
40
40
assert_success
41
41
42
42
# ensure that the build was successfully created
@@ -56,7 +56,7 @@ teardown() {
56
56
build_name=$( random_name)
57
57
58
58
# create a Build with node selector
59
- run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --node=" kubernetes.io/hostname=node-1"
59
+ run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --node-selector =" kubernetes.io/hostname=node-1"
60
60
assert_success
61
61
62
62
# ensure that the build was successfully created
@@ -75,7 +75,7 @@ teardown() {
75
75
build_name=$( random_name)
76
76
77
77
# create a Build with node selector
78
- run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --node=" kubernetes.io/hostname=node-1" --node=" kubernetes.io/os=linux"
78
+ run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --node-selector =" kubernetes.io/hostname=node-1" --node-selector =" kubernetes.io/os=linux"
79
79
assert_success
80
80
81
81
# ensure that the build was successfully created
@@ -87,4 +87,28 @@ teardown() {
87
87
88
88
assert_output --partial ' "kubernetes.io/hostname":"node-1"'
89
89
assert_output --partial ' "kubernetes.io/os":"linux"'
90
+ }
91
+
92
+
93
+ @test " shp build run with node-selector set" {
94
+ # generate random names for our build
95
+ build_name=$( random_name)
96
+
97
+ # create a Build with node selector
98
+ run shp build create ${build_name} --source-git-url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image
99
+ assert_success
100
+
101
+ # ensure that the build was successfully created
102
+ assert_output --partial " Created build \" ${build_name} \" "
103
+
104
+ # get the build object
105
+ run kubectl get builds.shipwright.io/${build_name}
106
+ assert_success
107
+
108
+ run shp build run ${build_name} --node-selector=" kubernetes.io/hostname=node-1"
109
+
110
+ # get the jsonpath of Build object .spec.nodeSelector
111
+ run kubectl get buildruns.shipwright.io -ojsonpath=' {.items[*].spec.nodeSelector}'
112
+ assert_success
113
+ assert_output --partial ' "kubernetes.io/hostname":"node-1"'
90
114
}
0 commit comments