3
3
source test/e2e/helpers.sh
4
4
5
5
setup () {
6
- load ' bats/support/load'
7
- load ' bats/assert/load'
8
- load ' bats/file/load'
6
+ load ' bats/support/load'
7
+ load ' bats/assert/load'
8
+ load ' bats/file/load'
9
9
}
10
10
11
11
teardown () {
12
- run kubectl delete builds.shipwright.io --all
13
- run kubectl delete buildruns.shipwright.io --all
12
+ run kubectl delete builds.shipwright.io --all
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
- build_name=$( random_name)
20
+ build_name=$( random_name)
19
21
20
- # create a Build with node selector
22
+ # create a Build with node selector
21
23
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
24
assert_success
23
25
24
26
# ensure that the build was successfully created
25
- assert_output --partial " Created build \" ${build_name} \" "
27
+ assert_output --partial " Created build \" ${build_name} \" "
26
28
27
29
# get the jsonpath of Build object .spec.nodeSelector
28
- run kubectl get builds.shipwright.io/${build_name} -ojsonpath=" {.spec.nodeSelector}"
29
- assert_success
30
+ run kubectl get builds.shipwright.io/${build_name} -ojsonpath=" {.spec.nodeSelector}"
31
+ assert_success
30
32
31
33
assert_output ' {"kubernetes.io/hostname":"node-1"}'
32
34
}
33
35
34
36
@test " shp build create --node-selector multiple labels" {
35
37
# generate random names for our build
36
- build_name=$( random_name)
38
+ build_name=$( random_name)
37
39
38
- # create a Build with node selector
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
+ # create a Build with node selector
41
+ 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
42
assert_success
41
43
42
44
# ensure that the build was successfully created
43
- assert_output --partial " Created build \" ${build_name} \" "
45
+ assert_output --partial " Created build \" ${build_name} \" "
44
46
45
47
# get the jsonpath of Build object .spec.nodeSelector
46
- run kubectl get builds.shipwright.io/${build_name} -ojsonpath=" {.spec.nodeSelector}"
47
- assert_success
48
+ run kubectl get builds.shipwright.io/${build_name} -ojsonpath=" {.spec.nodeSelector}"
49
+ assert_success
48
50
49
51
assert_output --partial ' "kubernetes.io/hostname":"node-1"'
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
- buildrun_name=$( random_name)
56
- build_name=$( random_name)
75
+ buildrun_name=$( random_name)
76
+ build_name=$( random_name)
57
77
58
- # create a Build with node selector
78
+ # create a Build with node selector
59
79
run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --node-selector=" kubernetes.io/hostname=node-1"
60
80
assert_success
61
81
62
82
# ensure that the build was successfully created
63
- assert_output --partial " BuildRun created \" ${buildrun_name} \" for Build \" ${build_name} \" "
83
+ assert_output --partial " BuildRun created \" ${buildrun_name} \" for Build \" ${build_name} \" "
64
84
65
85
# get the jsonpath of Build object .spec.nodeSelector
66
- run kubectl get buildruns.shipwright.io/${buildrun_name} -ojsonpath=" {.spec.nodeSelector}"
67
- assert_success
86
+ run kubectl get buildruns.shipwright.io/${buildrun_name} -ojsonpath=" {.spec.nodeSelector}"
87
+ assert_success
68
88
69
89
assert_output ' {"kubernetes.io/hostname":"node-1"}'
70
90
}
71
91
72
92
@test " shp buildrun create --node-selector multiple labels" {
73
93
# generate random names for our buildrun
74
- buildrun_name=$( random_name)
75
- build_name=$( random_name)
94
+ buildrun_name=$( random_name)
95
+ build_name=$( random_name)
76
96
77
- # create a Build with node selector
78
- run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --node-selector=" kubernetes.io/hostname=node-1" --node-selector=" kubernetes.io/os=linux"
97
+ # create a Build with node selector
98
+ run shp buildrun create ${buildrun_name} --buildref-name=${build_name} --node-selector=" kubernetes.io/hostname=node-1" --node-selector=" kubernetes.io/os=linux"
79
99
assert_success
80
100
81
101
# ensure that the build was successfully created
82
- assert_output --partial " BuildRun created \" ${buildrun_name} \" for Build \" ${build_name} \" "
102
+ assert_output --partial " BuildRun created \" ${buildrun_name} \" for Build \" ${build_name} \" "
83
103
84
104
# get the jsonpath of Build object .spec.nodeSelector
85
- run kubectl get buildruns.shipwright.io/${buildrun_name} -ojsonpath=" {.spec.nodeSelector}"
86
- assert_success
105
+ run kubectl get buildruns.shipwright.io/${buildrun_name} -ojsonpath=" {.spec.nodeSelector}"
106
+ assert_success
87
107
88
108
assert_output --partial ' "kubernetes.io/hostname":"node-1"'
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
+ }
92
130
93
131
@test " shp build run --node-selector set" {
94
132
# generate random names for our build
95
- build_name=$( random_name)
133
+ build_name=$( random_name)
96
134
97
- # create a Build with node selector
135
+ # create a Build with node selector
98
136
run shp build create ${build_name} --source-git-url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image
99
137
assert_success
100
138
101
139
# ensure that the build was successfully created
102
- assert_output --partial " Created build \" ${build_name} \" "
140
+ assert_output --partial " Created build \" ${build_name} \" "
103
141
104
142
# get the build object
105
- run kubectl get builds.shipwright.io/${build_name}
106
- assert_success
143
+ run kubectl get builds.shipwright.io/${build_name}
144
+ assert_success
107
145
108
146
run shp build run ${build_name} --node-selector=" kubernetes.io/hostname=node-1"
109
147
110
148
# get the jsonpath of Build object .spec.nodeSelector
111
- run kubectl get buildruns.shipwright.io -ojsonpath=' {.items[*].spec.nodeSelector}'
112
- assert_success
149
+ run kubectl get buildruns.shipwright.io -ojsonpath=' {.items[*].spec.nodeSelector}'
150
+ assert_success
113
151
assert_output --partial ' "kubernetes.io/hostname":"node-1"'
114
- }
152
+ }
153
+
154
+ @test " shp build run --scheduler-name" {
155
+ # generate random names for our build
156
+ build_name=$( random_name)
157
+
158
+ # create a Build with node selector
159
+ run shp build create ${build_name} --source-git-url=https://github.com/shipwright-io/sample-go --output-image=my-fake-image
160
+ assert_success
161
+
162
+ # ensure that the build was successfully created
163
+ assert_output --partial " Created build \" ${build_name} \" "
164
+
165
+ # get the build object
166
+ run kubectl get builds.shipwright.io/${build_name}
167
+ assert_success
168
+
169
+ run shp build run ${build_name} --scheduler-name=${scheduler_name}
170
+
171
+ # get the jsonpath of BuildRun object .spec.schedulerName
172
+ run kubectl get buildruns.shipwright.io -l build.shipwright.io/name=${build_name} -ojsonpath=' {.spec.schedulerName}'
173
+ assert_success
174
+ assert_output --partial " ${scheduler_name} "
175
+ }
0 commit comments