Skip to content

Commit 506d148

Browse files
authored
Updating stemcell test fixtures (#35)
* Updating stemcell version in tests * Update source names to include hvm in path Authored-by: Wayne Adams <wayne.adams@broadcom.com> Signed-off-by: Wayne Adams <wayne.adams@broadcom.com>
1 parent 74b110a commit 506d148

File tree

3 files changed

+47
-26
lines changed

3 files changed

+47
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
Tracks the versions of a stemcell on [bosh.io](https://bosh.io).
44

5-
For example, to automatically consume `bosh-aws-xen-ubuntu-trusty-go_agent`:
5+
For example, to automatically consume `bosh-aws-xen-hvm-ubuntu-trusty-go_agent`:
66

77
```yaml
88
resources:
99
- name: aws-stemcell
1010
type: bosh-io-stemcell
1111
source:
12-
name: bosh-aws-xen-ubuntu-trusty-go_agent
12+
name: bosh-aws-xen-hvm-ubuntu-trusty-go_agent
1313
```
1414
1515
## Source Configuration

acceptance/check_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const lightOnlyForceRegularRequest = `
7373
const bothTypesForceRegularRequest = `
7474
{
7575
"source": {
76-
"name": "bosh-aws-xen-ubuntu-trusty-go_agent",
76+
"name": "bosh-aws-xen-hvm-ubuntu-trusty-go_agent",
7777
"force_regular": true
7878
}
7979
}`

acceptance/in_test.go

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package acceptance_test
33
import (
44
"bytes"
55
"crypto/sha1"
6+
"crypto/sha256"
67
"fmt"
78
"io/ioutil"
89
"os"
@@ -25,7 +26,7 @@ const lightStemcellRequest = `
2526
"tarball": false
2627
},
2728
"version": {
28-
"version": "3262.4"
29+
"version": "3586.100"
2930
}
3031
}`
3132

@@ -35,28 +36,28 @@ const regularStemcellRequest = `
3536
"name": "bosh-azure-hyperv-ubuntu-trusty-go_agent"
3637
},
3738
"version": {
38-
"version": "3262.9"
39+
"version": "3586.100"
3940
}
4041
}`
4142

4243
const bothTypesStemcellRequest = `
4344
{
4445
"source": {
45-
"name": "bosh-aws-xen-ubuntu-trusty-go_agent"
46+
"name": "bosh-aws-xen-hvm-ubuntu-trusty-go_agent"
4647
},
4748
"version": {
48-
"version": "3262.4"
49+
"version": "3586.100"
4950
}
5051
}`
5152

5253
const bothTypesForceRegularStemcellRequest = `
5354
{
5455
"source": {
55-
"name": "bosh-aws-xen-ubuntu-trusty-go_agent",
56+
"name": "bosh-aws-xen-hvm-ubuntu-trusty-go_agent",
5657
"force_regular": true
5758
},
5859
"version": {
59-
"version": "3262.4"
60+
"version": "3586.100"
6061
}
6162
}`
6263

@@ -69,7 +70,7 @@ const stemcellRequestWithFileName = `
6970
"preserve_filename": true
7071
},
7172
"version": {
72-
"version": "3262.12"
73+
"version": "3586.100"
7374
}
7475
}`
7576

@@ -114,19 +115,23 @@ var _ = Describe("in", func() {
114115

115116
<-session.Exited
116117
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"}\]}`))
118119

119120
version, err := ioutil.ReadFile(filepath.Join(contentDir, "version"))
120121
Expect(err).NotTo(HaveOccurred())
121-
Expect(string(version)).To(Equal("3262.4"))
122+
Expect(string(version)).To(Equal("3586.100"))
122123

123124
url, err := ioutil.ReadFile(filepath.Join(contentDir, "url"))
124125
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"))
126131

127-
checksum, err := ioutil.ReadFile(filepath.Join(contentDir, "sha1"))
132+
sha256Checksum, err := ioutil.ReadFile(filepath.Join(contentDir, "sha256"))
128133
Expect(err).NotTo(HaveOccurred())
129-
Expect(string(checksum)).To(Equal("58b80c916ad523defea9e661045b7fc700a9ec4f"))
134+
Expect(string(sha256Checksum)).To(Equal("e03853323c7f5636e78a6322935274ba9acbcd525e967f5e609c3a3fcf3e7ab9"))
130135
})
131136
})
132137
})
@@ -162,11 +167,15 @@ var _ = Describe("in", func() {
162167
tarballBytes, err := ioutil.ReadFile(filepath.Join(contentDir, "stemcell.tgz"))
163168
Expect(err).NotTo(HaveOccurred())
164169

165-
checksum, err := ioutil.ReadFile(filepath.Join(contentDir, "sha1"))
170+
sha1Checksum, err := ioutil.ReadFile(filepath.Join(contentDir, "sha1"))
166171
Expect(err).NotTo(HaveOccurred())
172+
Expect(string(sha1Checksum)).To(Equal(fmt.Sprintf("%x", sha1.Sum(tarballBytes))))
167173

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))))
170179
})
171180
})
172181
})
@@ -201,9 +210,13 @@ var _ = Describe("in", func() {
201210
tarballBytes, err := ioutil.ReadFile(filepath.Join(contentDir, "stemcell.tgz"))
202211
Expect(err).NotTo(HaveOccurred())
203212

204-
checksum, err := ioutil.ReadFile(filepath.Join(contentDir, "sha1"))
213+
sha1Checksum, err := ioutil.ReadFile(filepath.Join(contentDir, "sha1"))
205214
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))))
207220

208221
urlBytes, err := ioutil.ReadFile(filepath.Join(contentDir, "url"))
209222
Expect(err).NotTo(HaveOccurred())
@@ -241,9 +254,13 @@ var _ = Describe("in", func() {
241254
tarballBytes, err := ioutil.ReadFile(filepath.Join(contentDir, "stemcell.tgz"))
242255
Expect(err).NotTo(HaveOccurred())
243256

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"))
245262
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))))
247264

248265
urlBytes, err := ioutil.ReadFile(filepath.Join(contentDir, "url"))
249266
Expect(err).NotTo(HaveOccurred())
@@ -279,14 +296,18 @@ var _ = Describe("in", func() {
279296
<-session.Exited
280297
Expect(session.ExitCode()).To(Equal(0))
281298

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"))
283300
Expect(err).NotTo(HaveOccurred())
284301

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))))
287305

306+
sha256Checksum, err := ioutil.ReadFile(filepath.Join(contentDir, "sha256"))
288307
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))))
290311
})
291312
})
292313
})

0 commit comments

Comments
 (0)