@@ -3,6 +3,7 @@ package acceptance_test
3
3
import (
4
4
"bytes"
5
5
"crypto/sha1"
6
+ "crypto/sha256"
6
7
"fmt"
7
8
"io/ioutil"
8
9
"os"
@@ -25,7 +26,7 @@ const lightStemcellRequest = `
25
26
"tarball": false
26
27
},
27
28
"version": {
28
- "version": "3262.4 "
29
+ "version": "3586.100 "
29
30
}
30
31
}`
31
32
@@ -35,28 +36,28 @@ const regularStemcellRequest = `
35
36
"name": "bosh-azure-hyperv-ubuntu-trusty-go_agent"
36
37
},
37
38
"version": {
38
- "version": "3262.9 "
39
+ "version": "3586.100 "
39
40
}
40
41
}`
41
42
42
43
const bothTypesStemcellRequest = `
43
44
{
44
45
"source": {
45
- "name": "bosh-aws-xen-ubuntu-trusty-go_agent"
46
+ "name": "bosh-aws-xen-hvm- ubuntu-trusty-go_agent"
46
47
},
47
48
"version": {
48
- "version": "3262.4 "
49
+ "version": "3586.100 "
49
50
}
50
51
}`
51
52
52
53
const bothTypesForceRegularStemcellRequest = `
53
54
{
54
55
"source": {
55
- "name": "bosh-aws-xen-ubuntu-trusty-go_agent",
56
+ "name": "bosh-aws-xen-hvm- ubuntu-trusty-go_agent",
56
57
"force_regular": true
57
58
},
58
59
"version": {
59
- "version": "3262.4 "
60
+ "version": "3586.100 "
60
61
}
61
62
}`
62
63
@@ -69,7 +70,7 @@ const stemcellRequestWithFileName = `
69
70
"preserve_filename": true
70
71
},
71
72
"version": {
72
- "version": "3262.12 "
73
+ "version": "3586.100 "
73
74
}
74
75
}`
75
76
@@ -114,19 +115,23 @@ var _ = Describe("in", func() {
114
115
115
116
<- session .Exited
116
117
Expect (session .ExitCode ()).To (Equal (0 ))
117
- Expect (session .Out ).To (gbytes .Say (`{"version":{"version":"3262.4 "},"metadata":\[{"name":"url","value":"https://d26ekeud912fhb.cloudfront.net /bosh-stemcell/ aws/ light-bosh-stemcell-3262.4 -aws-xen-hvm-ubuntu-trusty-go_agent.tgz"},{"name":"sha1","value":"58b80c916ad523defea9e661045b7fc700a9ec4f "}\]}` ))
118
+ Expect (session .Out ).To (gbytes .Say (`{"version":{"version":"3586.100 "},"metadata":\[{"name":"url","value":"https://s3.amazonaws.com /bosh-aws-light-stemcells/3586.100/ light-bosh-stemcell-3586.100 -aws-xen-hvm-ubuntu-trusty-go_agent.tgz"},{"name":"sha1","value":"b78c60c1bc60d91d798bccc098180167c3c794fe"},{"name":"sha256","value":"e03853323c7f5636e78a6322935274ba9acbcd525e967f5e609c3a3fcf3e7ab9 "}\]}` ))
118
119
119
120
version , err := ioutil .ReadFile (filepath .Join (contentDir , "version" ))
120
121
Expect (err ).NotTo (HaveOccurred ())
121
- Expect (string (version )).To (Equal ("3262.4 " ))
122
+ Expect (string (version )).To (Equal ("3586.100 " ))
122
123
123
124
url , err := ioutil .ReadFile (filepath .Join (contentDir , "url" ))
124
125
Expect (err ).NotTo (HaveOccurred ())
125
- Expect (string (url )).To (Equal ("https://d26ekeud912fhb.cloudfront.net/bosh-stemcell/aws/light-bosh-stemcell-3262.4-aws-xen-hvm-ubuntu-trusty-go_agent.tgz" ))
126
+ Expect (string (url )).To (Equal ("https://s3.amazonaws.com/bosh-aws-light-stemcells/3586.100/light-bosh-stemcell-3586.100-aws-xen-hvm-ubuntu-trusty-go_agent.tgz" ))
127
+
128
+ sha1Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
129
+ Expect (err ).NotTo (HaveOccurred ())
130
+ Expect (string (sha1Checksum )).To (Equal ("b78c60c1bc60d91d798bccc098180167c3c794fe" ))
126
131
127
- checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1 " ))
132
+ sha256Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha256 " ))
128
133
Expect (err ).NotTo (HaveOccurred ())
129
- Expect (string (checksum )).To (Equal ("58b80c916ad523defea9e661045b7fc700a9ec4f " ))
134
+ Expect (string (sha256Checksum )).To (Equal ("e03853323c7f5636e78a6322935274ba9acbcd525e967f5e609c3a3fcf3e7ab9 " ))
130
135
})
131
136
})
132
137
})
@@ -162,11 +167,15 @@ var _ = Describe("in", func() {
162
167
tarballBytes , err := ioutil .ReadFile (filepath .Join (contentDir , "stemcell.tgz" ))
163
168
Expect (err ).NotTo (HaveOccurred ())
164
169
165
- checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
170
+ sha1Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
166
171
Expect (err ).NotTo (HaveOccurred ())
172
+ Expect (string (sha1Checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 .Sum (tarballBytes ))))
167
173
168
- Expect (session .Out ).To (gbytes .Say (fmt .Sprintf (`{"version":{"version":"3262.9"},"metadata":\[{"name":"url","value":"https://s3.amazonaws.com/bosh-azure-stemcells/bosh-stemcell-3262.9-azure-hyperv-ubuntu-trusty-go_agent.tgz"},{"name":"sha1","value":"%s"}\]}` , string (checksum ))))
169
- Expect (string (checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 .Sum (tarballBytes ))))
174
+ sha256Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha256" ))
175
+ Expect (err ).NotTo (HaveOccurred ())
176
+ Expect (string (sha256Checksum )).To (Equal (fmt .Sprintf ("%x" , sha256 .Sum256 (tarballBytes ))))
177
+
178
+ Expect (session .Out ).To (gbytes .Say (fmt .Sprintf (`{"version":{"version":"3586.100"},"metadata":\[{"name":"url","value":"https://s3.amazonaws.com/bosh-core-stemcells/3586.100/bosh-stemcell-3586.100-azure-hyperv-ubuntu-trusty-go_agent.tgz"},{"name":"sha1","value":"%s"},{"name":"sha256","value":"%s"}\]}` , string (sha1Checksum ), string (sha256Checksum ))))
170
179
})
171
180
})
172
181
})
@@ -201,9 +210,13 @@ var _ = Describe("in", func() {
201
210
tarballBytes , err := ioutil .ReadFile (filepath .Join (contentDir , "stemcell.tgz" ))
202
211
Expect (err ).NotTo (HaveOccurred ())
203
212
204
- checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
213
+ sha1Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
205
214
Expect (err ).NotTo (HaveOccurred ())
206
- Expect (string (checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 .Sum (tarballBytes ))))
215
+ Expect (string (sha1Checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 .Sum (tarballBytes ))))
216
+
217
+ sha256Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha256" ))
218
+ Expect (err ).NotTo (HaveOccurred ())
219
+ Expect (string (sha256Checksum )).To (Equal (fmt .Sprintf ("%x" , sha256 .Sum256 (tarballBytes ))))
207
220
208
221
urlBytes , err := ioutil .ReadFile (filepath .Join (contentDir , "url" ))
209
222
Expect (err ).NotTo (HaveOccurred ())
@@ -241,9 +254,13 @@ var _ = Describe("in", func() {
241
254
tarballBytes , err := ioutil .ReadFile (filepath .Join (contentDir , "stemcell.tgz" ))
242
255
Expect (err ).NotTo (HaveOccurred ())
243
256
244
- checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
257
+ sha1Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
258
+ Expect (err ).NotTo (HaveOccurred ())
259
+ Expect (string (sha1Checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 .Sum (tarballBytes ))))
260
+
261
+ sha256Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha256" ))
245
262
Expect (err ).NotTo (HaveOccurred ())
246
- Expect (string (checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 . Sum (tarballBytes ))))
263
+ Expect (string (sha256Checksum )).To (Equal (fmt .Sprintf ("%x" , sha256 . Sum256 (tarballBytes ))))
247
264
248
265
urlBytes , err := ioutil .ReadFile (filepath .Join (contentDir , "url" ))
249
266
Expect (err ).NotTo (HaveOccurred ())
@@ -279,14 +296,18 @@ var _ = Describe("in", func() {
279
296
<- session .Exited
280
297
Expect (session .ExitCode ()).To (Equal (0 ))
281
298
282
- tarballBytes , err := ioutil .ReadFile (filepath .Join (contentDir , "light-bosh-stemcell-3262.12 -aws-xen-hvm-ubuntu-trusty-go_agent.tgz" ))
299
+ tarballBytes , err := ioutil .ReadFile (filepath .Join (contentDir , "light-bosh-stemcell-3586.100 -aws-xen-hvm-ubuntu-trusty-go_agent.tgz" ))
283
300
Expect (err ).NotTo (HaveOccurred ())
284
301
285
- checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
286
- Expect (session .Out ).To (gbytes .Say (fmt .Sprintf (`{"version":{"version":"3262.12"},"metadata":\[{"name":"url","value":"https://d26ekeud912fhb.cloudfront.net/bosh-stemcell/aws/light-bosh-stemcell-3262.12-aws-xen-hvm-ubuntu-trusty-go_agent.tgz"},{"name":"sha1","value":"%s"}\]}` , string (checksum ))))
302
+ sha1Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha1" ))
303
+ Expect (err ).NotTo (HaveOccurred ())
304
+ Expect (string (sha1Checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 .Sum (tarballBytes ))))
287
305
306
+ sha256Checksum , err := ioutil .ReadFile (filepath .Join (contentDir , "sha256" ))
288
307
Expect (err ).NotTo (HaveOccurred ())
289
- Expect (string (checksum )).To (Equal (fmt .Sprintf ("%x" , sha1 .Sum (tarballBytes ))))
308
+ Expect (string (sha256Checksum )).To (Equal (fmt .Sprintf ("%x" , sha256 .Sum256 (tarballBytes ))))
309
+
310
+ Expect (session .Out ).To (gbytes .Say (fmt .Sprintf (`{"version":{"version":"3586.100"},"metadata":\[{"name":"url","value":"https://s3.amazonaws.com/bosh-aws-light-stemcells/3586.100/light-bosh-stemcell-3586.100-aws-xen-hvm-ubuntu-trusty-go_agent.tgz"},{"name":"sha1","value":"%s"},{"name":"sha256","value":"%s"}\]}` , string (sha1Checksum ), string (sha256Checksum ))))
290
311
})
291
312
})
292
313
})
0 commit comments