Skip to content

Commit

Permalink
Revert "Remove support for $ARTIFACT_DIRECTORY"
Browse files Browse the repository at this point in the history
This reverts commit 3cc9e76.
  • Loading branch information
MirahImage committed Jul 26, 2018
1 parent 43bbd83 commit 13cdbfe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fixtures/releases
1 change: 1 addition & 0 deletions instance/deployed_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (i *DeployedInstance) Backup() error {
func artifactDirectoryVariables(artifactDirectory string) map[string]string {
return map[string]string{
"BBR_ARTIFACT_DIRECTORY": artifactDirectory + "/",
"ARTIFACT_DIRECTORY": artifactDirectory + "/",
}
}

Expand Down
19 changes: 15 additions & 4 deletions instance/deployed_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ var _ = Describe("DeployedInstance", func() {
})

It("uses the remote runner to create each job's backup folder and run each backup script providing the "+
"correct BBR_ARTIFACT_DIRECTORY", func() {
"correct ARTIFACT_DIRECTORY and BBR_ARTIFACT_DIRECTORY", func() {
Expect(remoteRunner.CreateDirectoryCallCount()).To(Equal(3))
Expect(remoteRunner.RunScriptWithEnvCallCount()).To(Equal(3))
Expect([]string{
Expand All @@ -244,18 +244,21 @@ var _ = Describe("DeployedInstance", func() {
specifiedScriptPath, specifiedEnvVars, _ := remoteRunner.RunScriptWithEnvArgsForCall(0)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/foo/bin/bbr/backup"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
}))

specifiedScriptPath, specifiedEnvVars, _ = remoteRunner.RunScriptWithEnvArgsForCall(1)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/bar/bin/bbr/backup"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/bar/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/bar/",
}))

specifiedScriptPath, specifiedEnvVars, _ = remoteRunner.RunScriptWithEnvArgsForCall(2)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/baz/bin/bbr/backup"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/baz/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/baz/",
}))
})
Expand Down Expand Up @@ -307,7 +310,7 @@ var _ = Describe("DeployedInstance", func() {
})

It("uses the remote runner to create each job's backup folder and run each backup script providing the "+
"correct BBR_ARTIFACT_DIRECTORY", func() {
"correct BBR_ARTIFACT_DIRECTORY and ARTIFACT_DIRECTORY", func() {

Expect(remoteRunner.CreateDirectoryCallCount()).To(Equal(2))
Expect(remoteRunner.RunScriptWithEnvCallCount()).To(Equal(2))
Expand All @@ -321,12 +324,14 @@ var _ = Describe("DeployedInstance", func() {
specifiedScriptPath, specifiedEnvVars, _ := remoteRunner.RunScriptWithEnvArgsForCall(0)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/foo/bin/bbr/backup"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
}))

specifiedScriptPath, specifiedEnvVars, _ = remoteRunner.RunScriptWithEnvArgsForCall(1)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/baz/bin/bbr/backup"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/special-backup/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/special-backup/",
}))

Expand Down Expand Up @@ -415,24 +420,27 @@ var _ = Describe("DeployedInstance", func() {
})
})

It("uses the remote runner to run each restore script providing the correct BBR_ARTIFACT_DIRECTORY", func() {
It("uses the remote runner to run each restore script providing the correct ARTIFACT_DIRECTORY", func() {
Expect(remoteRunner.RunScriptWithEnvCallCount()).To(Equal(3))

specifiedScriptPath, specifiedEnvVars, _ := remoteRunner.RunScriptWithEnvArgsForCall(0)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/foo/bin/bbr/restore"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
}))

specifiedScriptPath, specifiedEnvVars, _ = remoteRunner.RunScriptWithEnvArgsForCall(1)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/bar/bin/bbr/restore"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/bar/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/bar/",
}))

specifiedScriptPath, specifiedEnvVars, _ = remoteRunner.RunScriptWithEnvArgsForCall(2)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/baz/bin/bbr/restore"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/baz/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/baz/",
}))
})
Expand Down Expand Up @@ -487,24 +495,27 @@ var _ = Describe("DeployedInstance", func() {
Expect(actualError).NotTo(HaveOccurred())
})

It("uses the remote runner to create each job's backup folder and run each backup script providing the correct BBR_ARTIFACT_DIRECTORY", func() {
It("uses the remote runner to create each job's backup folder and run each backup script providing the correct BBR_ARTIFACT_DIRECTORY and ARTIFACT_DIRECTORY", func() {
Expect(remoteRunner.RunScriptWithEnvCallCount()).To(Equal(3))

specifiedScriptPath, specifiedEnvVars, _ := remoteRunner.RunScriptWithEnvArgsForCall(0)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/foo/bin/bbr/restore"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/foo/",
}))

specifiedScriptPath, specifiedEnvVars, _ = remoteRunner.RunScriptWithEnvArgsForCall(1)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/bar/bin/bbr/restore"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/bar/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/bar/",
}))

specifiedScriptPath, specifiedEnvVars, _ = remoteRunner.RunScriptWithEnvArgsForCall(2)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/baz/bin/bbr/restore"))
Expect(specifiedEnvVars).To(Equal(map[string]string{
"ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/special-backup/",
"BBR_ARTIFACT_DIRECTORY": "/var/vcap/store/bbr-backup/special-backup/",
}))
})
Expand Down
6 changes: 4 additions & 2 deletions instance/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ var _ = Describe("Job", func() {
specifiedScriptPath, specifiedEnvVars, _ := remoteRunner.RunScriptWithEnvArgsForCall(0)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/jobname/bin/bbr/backup"))
Expect(specifiedEnvVars).To(SatisfyAll(
HaveLen(1),
HaveLen(2),
HaveKeyWithValue("ARTIFACT_DIRECTORY", "/var/vcap/store/bbr-backup/jobname/"),
HaveKeyWithValue("BBR_ARTIFACT_DIRECTORY", "/var/vcap/store/bbr-backup/jobname/"),
))
})
Expand Down Expand Up @@ -327,7 +328,8 @@ var _ = Describe("Job", func() {
specifiedScriptPath, specifiedEnvVars, _ := remoteRunner.RunScriptWithEnvArgsForCall(0)
Expect(specifiedScriptPath).To(Equal("/var/vcap/jobs/jobname/bin/bbr/restore"))
Expect(specifiedEnvVars).To(SatisfyAll(
HaveLen(1),
HaveLen(2),
HaveKeyWithValue("ARTIFACT_DIRECTORY", "/var/vcap/store/bbr-backup/jobname/"),
HaveKeyWithValue("BBR_ARTIFACT_DIRECTORY", "/var/vcap/store/bbr-backup/jobname/"),
))
})
Expand Down

0 comments on commit 13cdbfe

Please sign in to comment.