@@ -13,6 +13,8 @@ teardown() {
13
13
run kubectl delete buildruns.shipwright.io --all
14
14
}
15
15
16
+ scheduler_name=" dolphinscheduler"
17
+
16
18
@test " shp build create --node-selector single label" {
17
19
# generate random names for our build
18
20
build_name=$( random_name)
@@ -50,6 +52,24 @@ teardown() {
50
52
assert_output --partial ' "kubernetes.io/os":"linux"'
51
53
}
52
54
55
+ @test " shp build create --scheduler-name" {
56
+ # generate random names for our build
57
+ build_name=$( random_name)
58
+
59
+ # create a Build with node selector
60
+ run shp build create ${build_name} --source-git-url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image --scheduler-name=${scheduler_name}
61
+ assert_success
62
+
63
+ # ensure that the build was successfully created
64
+ assert_output --partial " Created build \" ${build_name} \" "
65
+
66
+ # get the jsonpath of Build object .spec.nodeSelector
67
+ run kubectl get builds.shipwright.io/${build_name} -ojsonpath=" {.spec.schedulerName}"
68
+ assert_success
69
+
70
+ assert_output " ${scheduler_name} "
71
+ }
72
+
53
73
@test " shp buildrun create --node-selector single label" {
54
74
# generate random names for our buildrun
55
75
buildrun_name=$( random_name)
@@ -89,6 +109,25 @@ teardown() {
89
109
assert_output --partial ' "kubernetes.io/os":"linux"'
90
110
}
91
111
112
+ @test " shp buildrun create --scheduler-name" {
113
+ # generate random names for our buildrun
114
+ buildrun_name=$( random_name)
115
+ build_name=$( random_name)
116
+
117
+ # create a Build with node selector
118
+ run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --scheduler-name=${scheduler_name}
119
+ assert_success
120
+
121
+ # ensure that the build was successfully created
122
+ assert_output --partial " BuildRun created \" ${buildrun_name} \" for Build \" ${build_name} \" "
123
+
124
+ # get the jsonpath of Build object .spec.nodeSelector
125
+ run kubectl get buildruns.shipwright.io/${buildrun_name} -ojsonpath=" {.spec.schedulerName}"
126
+ assert_success
127
+
128
+ assert_output " ${scheduler_name} "
129
+ }
130
+
92
131
93
132
@test " shp build run --node-selector set" {
94
133
# generate random names for our build
@@ -111,4 +150,27 @@ teardown() {
111
150
run kubectl get buildruns.shipwright.io -ojsonpath=' {.items[*].spec.nodeSelector}'
112
151
assert_success
113
152
assert_output --partial ' "kubernetes.io/hostname":"node-1"'
153
+ }
154
+
155
+ @test " shp build run --scheduler-name" {
156
+ # generate random names for our build
157
+ build_name=$( random_name)
158
+
159
+ # create a Build with node selector
160
+ run shp build create ${build_name} --source-git-url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image
161
+ assert_success
162
+
163
+ # ensure that the build was successfully created
164
+ assert_output --partial " Created build \" ${build_name} \" "
165
+
166
+ # get the build object
167
+ run kubectl get builds.shipwright.io/${build_name}
168
+ assert_success
169
+
170
+ run shp build run ${build_name} --scheduler-name=${scheduler_name}
171
+
172
+ # get the jsonpath of Build object .spec.nodeSelector
173
+ run kubectl get buildruns.shipwright.io -ojsonpath=' {.items[*].spec.schedulerName}'
174
+ assert_success
175
+ assert_output --partial " ${scheduler_name} "
114
176
}
0 commit comments