Skip to content

Commit

Permalink
Remove Trump
Browse files Browse the repository at this point in the history
[#141764475]

Signed-off-by: Rosie Bloxsom <rbloxsom@pivotal.io>
  • Loading branch information
Henry Stanley authored and Rosie Bloxsom committed Mar 17, 2017
1 parent 761b13b commit 09557b4
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 59 deletions.
6 changes: 3 additions & 3 deletions bosh/deployed_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ var _ = Describe("Instance", func() {
Context("when there are several scripts and one of them fails to run backup while another one causes an error", func() {
expectedStdout := "some stdout"
expectedStderr := "some stderr"
expectedError := fmt.Errorf("you are fake news")
expectedError := fmt.Errorf("I have a problem with your code")

BeforeEach(func() {
backupAndRestoreScripts = []instance.Script{
Expand Down Expand Up @@ -602,7 +602,7 @@ var _ = Describe("Instance", func() {
Context("when there are several scripts and one of them fails to run post-backup-unlock while another one causes an error", func() {
expectedStdout := "some stdout"
expectedStderr := "some stderr"
expectedError := fmt.Errorf("you are fake news")
expectedError := fmt.Errorf("I still have a problem with your code")

BeforeEach(func() {
backupAndRestoreScripts = []instance.Script{
Expand Down Expand Up @@ -762,7 +762,7 @@ var _ = Describe("Instance", func() {
Context("when there are several scripts and one of them fails to run restore while another one causes an error", func() {
expectedStdout := "some stdout"
expectedStderr := "some stderr"
expectedError := fmt.Errorf("i saw a million and a half people")
expectedError := fmt.Errorf("foo bar baz error")

BeforeEach(func() {
backupAndRestoreScripts = []instance.Script{
Expand Down
16 changes: 8 additions & 8 deletions instance/blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var _ = Describe("blob", func() {
var sshError error

BeforeEach(func() {
sshError = fmt.Errorf("I have the best SSH")
sshError = fmt.Errorf("SHH causing problems here")
sshConnection.StreamReturns([]byte("not relevant"), 0, sshError)
})

Expand Down Expand Up @@ -268,7 +268,7 @@ var _ = Describe("blob", func() {

Context("when an error occurs", func() {
var err error
var actualError = errors.New("we will load it up with some bad dudes")
var actualError = errors.New("oh noes, more errors")

BeforeEach(func() {
sshConnection.RunReturns(nil, nil, 0, actualError)
Expand Down Expand Up @@ -315,23 +315,23 @@ var _ = Describe("blob", func() {

Describe("when the remote side returns an error", func() {
BeforeEach(func() {
sshConnection.StreamStdinReturns([]byte("not relevant"), []byte("The beauty of me is that I’m very rich."), 1, nil)
sshConnection.StreamStdinReturns([]byte("not relevant"), []byte("All the pies"), 1, nil)
})

It("fails and return the error", func() {
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("The beauty of me is that I’m very rich."))
Expect(err.Error()).To(ContainSubstring("All the pies"))
})
})

Describe("when there is an error running the stream", func() {
BeforeEach(func() {
sshConnection.StreamStdinReturns([]byte("not relevant"), []byte("not relevant"), 0, fmt.Errorf("My Twitter has become so powerful"))
sshConnection.StreamStdinReturns([]byte("not relevant"), []byte("not relevant"), 0, fmt.Errorf("Errorerrororororororor"))
})

It("fails", func() {
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("My Twitter has become so powerful"))
Expect(err.Error()).To(ContainSubstring("Errorerrororororororor"))
})
})

Expand All @@ -348,12 +348,12 @@ var _ = Describe("blob", func() {

Describe("when creating the directory fails because of a connection error", func() {
BeforeEach(func() {
sshConnection.RunReturns([]byte("not relevant"), []byte("not relevant"), 0, fmt.Errorf("These media people. The most dishonest people"))
sshConnection.RunReturns([]byte("not relevant"), []byte("not relevant"), 0, fmt.Errorf("I refuse to create you this directory."))
})

It("fails and returns the error", func() {
Expect(err).To(HaveOccurred())
Expect(err).To(MatchError("These media people. The most dishonest people"))
Expect(err).To(MatchError("I refuse to create you this directory."))
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion instance/job_finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ backup_name: consul_backup`), nil, 0, nil
BeforeEach(func() {
sshConnection.RunStub = func(cmd string) ([]byte, []byte, int, error) {
if cmd == "/var/vcap/jobs/consul_agent/bin/b-metadata" {
return []byte(`they are being really unfair to me`), nil, 0, nil
return []byte(`this is very disappointing`), nil, 0, nil
}
return []byte("/var/vcap/jobs/consul_agent/bin/b-metadata"), nil, 0, nil
}
Expand Down
26 changes: 13 additions & 13 deletions orchestrator/backuper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ var _ = Describe("Backup", func() {
})

Describe("failures", func() {
var expectedError = fmt.Errorf("Jesus!")
var expectedError = fmt.Errorf("Profanity")
var assertCleanupError = func() {
var cleanupError = fmt.Errorf("he was born in kenya")
var cleanupError = fmt.Errorf("gosh, it's a bit filthy in here")
BeforeEach(func() {
deployment.CleanupReturns(cleanupError)
})
Expand Down Expand Up @@ -141,7 +141,7 @@ var _ = Describe("Backup", func() {
})

Context("fails if manifest can't be downloaded", func() {
var expectedError = fmt.Errorf("he the founder of isis")
var expectedError = fmt.Errorf("source of the nile")
BeforeEach(func() {
deploymentManager.FindReturns(deployment, nil)
deployment.IsBackupableReturns(true)
Expand All @@ -156,7 +156,7 @@ var _ = Describe("Backup", func() {
})

Context("fails if manifest can't be saved", func() {
var expectedError = fmt.Errorf("he the founder of isis")
var expectedError = fmt.Errorf("source of the nile")

BeforeEach(func() {
deploymentManager.FindReturns(deployment, nil)
Expand Down Expand Up @@ -207,7 +207,7 @@ var _ = Describe("Backup", func() {
})

Context("fails if pre-backup-lock fails", func() {
var lockError = orchestrator.NewLockError("it was going to be a smooth transition - NOT")
var lockError = orchestrator.NewLockError("smoooooooth jazz")

BeforeEach(func() {
boshClient.GetManifestReturns(deploymentManifest, nil)
Expand Down Expand Up @@ -236,7 +236,7 @@ var _ = Describe("Backup", func() {
var unlockError orchestrator.PostBackupUnlockError

BeforeEach(func() {
unlockError = orchestrator.NewPostBackupUnlockError("it was going to be a smooth transition - NOT")
unlockError = orchestrator.NewPostBackupUnlockError("lalalalala")
boshClient.GetManifestReturns(deploymentManifest, nil)
artifactManager.CreateReturns(artifact, nil)
artifactManager.ExistsReturns(false)
Expand All @@ -260,7 +260,7 @@ var _ = Describe("Backup", func() {
})

Context("when the drain artifact fails as well", func() {
var drainError = fmt.Errorf("i don't do email but i know about hacking")
var drainError = fmt.Errorf("just weird")

BeforeEach(func() {
deployment.CopyRemoteBackupToLocalReturns(drainError)
Expand All @@ -272,7 +272,7 @@ var _ = Describe("Backup", func() {
})

Context("cleanup fails as well", func() {
var cleanupError = orchestrator.NewCleanupError("he was born in kenya")
var cleanupError = orchestrator.NewCleanupError("here we go again")
BeforeEach(func() {
deployment.CleanupReturns(cleanupError)
})
Expand All @@ -293,7 +293,7 @@ var _ = Describe("Backup", func() {
})

Context("cleanup fails as well", func() {
var cleanupError = fmt.Errorf("he was born in kenya")
var cleanupError = fmt.Errorf("leave me alone")
BeforeEach(func() {
deployment.CleanupReturns(cleanupError)
})
Expand All @@ -309,7 +309,7 @@ var _ = Describe("Backup", func() {
})

Context("fails if backup cannot be drained", func() {
var drainError = fmt.Errorf("they are bringing crime")
var drainError = fmt.Errorf("I would like a sandwich")
BeforeEach(func() {
deploymentManager.FindReturns(deployment, nil)
deployment.IsBackupableReturns(true)
Expand Down Expand Up @@ -339,7 +339,7 @@ var _ = Describe("Backup", func() {
})

Context("fails if artifact cannot be created", func() {
var artifactError = fmt.Errorf("they are bringing crime")
var artifactError = fmt.Errorf("I would like a sandwich")
BeforeEach(func() {
deploymentManager.FindReturns(deployment, nil)
deployment.IsBackupableReturns(true)
Expand Down Expand Up @@ -368,7 +368,7 @@ var _ = Describe("Backup", func() {
})

Context("fails if the cleanup cannot be completed", func() {
var cleanupError = fmt.Errorf("why doesn't he show his birth certificate?")
var cleanupError = fmt.Errorf("a tuna sandwich")
BeforeEach(func() {
deploymentManager.FindReturns(deployment, nil)
deployment.IsBackupableReturns(true)
Expand Down Expand Up @@ -402,7 +402,7 @@ var _ = Describe("Backup", func() {
})

Context("fails if backup is not a success", func() {
var backupError = fmt.Errorf("i have the best words")
var backupError = fmt.Errorf("syzygy")
BeforeEach(func() {
deploymentManager.FindReturns(deployment, nil)
deployment.IsBackupableReturns(true)
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/deployment_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var _ = Describe("DeploymentManager", func() {
})

Context("error finding instances", func() {
var expectedFindError = fmt.Errorf("some I assume are good people")
var expectedFindError = fmt.Errorf("a tuna sandwich")
BeforeEach(func() {
boshClient.FindInstancesReturns(nil, expectedFindError)
})
Expand Down
40 changes: 20 additions & 20 deletions orchestrator/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ var _ = Describe("Deployment", func() {

Context("Multiple instances, some failing to backup", func() {
BeforeEach(func() {
backupError := fmt.Errorf("My IQ is one of the highest — and you all know it!")
backupError := fmt.Errorf("very clever sandwich")
instance1.IsBackupableReturns(true)
instance2.IsBackupableReturns(true)
instance1.BackupReturns(backupError)
Expand Down Expand Up @@ -511,7 +511,7 @@ var _ = Describe("Deployment", func() {
})

Context("Multiple instances, some failing to restore", func() {
var restoreError = fmt.Errorf("I have a plan, but I dont want to tell ISIS what it is")
var restoreError = fmt.Errorf("and some salt and vinegar crisps")

BeforeEach(func() {
instance1.IsRestorableReturns(true)
Expand Down Expand Up @@ -590,16 +590,16 @@ var _ = Describe("Deployment", func() {

Context("problem occurs streaming to instance", func() {
BeforeEach(func() {
backupBlob.StreamToRemoteReturns(fmt.Errorf("Tiny children are not horses"))
backupBlob.StreamToRemoteReturns(fmt.Errorf("streaming had a problem"))
})

It("fails", func() {
Expect(copyLocalBackupToRemoteError).To(HaveOccurred())
Expect(copyLocalBackupToRemoteError).To(MatchError("Tiny children are not horses"))
Expect(copyLocalBackupToRemoteError).To(MatchError("streaming had a problem"))
})
})
Context("problem calculating shasum on local", func() {
var checksumError = fmt.Errorf("because i am smart")
var checksumError = fmt.Errorf("I am so clever")
BeforeEach(func() {
artifact.FetchChecksumReturns(nil, checksumError)
})
Expand Down Expand Up @@ -633,12 +633,12 @@ var _ = Describe("Deployment", func() {

Context("problem occurs while reading from backup", func() {
BeforeEach(func() {
artifact.ReadFileReturns(nil, fmt.Errorf("an overrated clown"))
artifact.ReadFileReturns(nil, fmt.Errorf("leave me alone"))
})

It("fails", func() {
Expect(copyLocalBackupToRemoteError).To(HaveOccurred())
Expect(copyLocalBackupToRemoteError).To(MatchError("an overrated clown"))
Expect(copyLocalBackupToRemoteError).To(MatchError("leave me alone"))
})
})
})
Expand Down Expand Up @@ -679,16 +679,16 @@ var _ = Describe("Deployment", func() {

Context("problem occurs streaming to instance", func() {
BeforeEach(func() {
backupBlob.StreamToRemoteReturns(fmt.Errorf("Tiny children are not horses"))
backupBlob.StreamToRemoteReturns(fmt.Errorf("I'm still here"))
})

It("fails", func() {
Expect(copyLocalBackupToRemoteError).To(HaveOccurred())
Expect(copyLocalBackupToRemoteError).To(MatchError("Tiny children are not horses"))
Expect(copyLocalBackupToRemoteError).To(MatchError("I'm still here"))
})
})
Context("problem calculating shasum on local", func() {
var checksumError = fmt.Errorf("because i am smart")
var checksumError = fmt.Errorf("oh well")
BeforeEach(func() {
artifact.FetchChecksumReturns(nil, checksumError)
})
Expand Down Expand Up @@ -722,12 +722,12 @@ var _ = Describe("Deployment", func() {

Context("problem occurs while reading from backup", func() {
BeforeEach(func() {
artifact.ReadFileReturns(nil, fmt.Errorf("an overrated clown"))
artifact.ReadFileReturns(nil, fmt.Errorf("foo bar baz read error"))
})

It("fails", func() {
Expect(copyLocalBackupToRemoteError).To(HaveOccurred())
Expect(copyLocalBackupToRemoteError).To(MatchError("an overrated clown"))
Expect(copyLocalBackupToRemoteError).To(MatchError("foo bar baz read error"))
})
})
})
Expand Down Expand Up @@ -767,16 +767,16 @@ var _ = Describe("Deployment", func() {

Context("problem occurs streaming to instance", func() {
BeforeEach(func() {
backupBlob.StreamToRemoteReturns(fmt.Errorf("Tiny children are not horses"))
backupBlob.StreamToRemoteReturns(fmt.Errorf("this is a problem"))
})

It("fails", func() {
Expect(copyLocalBackupToRemoteError).To(HaveOccurred())
Expect(copyLocalBackupToRemoteError).To(MatchError("Tiny children are not horses"))
Expect(copyLocalBackupToRemoteError).To(MatchError("this is a problem"))
})
})
Context("problem calculating shasum on local", func() {
var checksumError = fmt.Errorf("because i am smart")
var checksumError = fmt.Errorf("checksum error occurred")
BeforeEach(func() {
artifact.FetchChecksumReturns(nil, checksumError)
})
Expand Down Expand Up @@ -810,12 +810,12 @@ var _ = Describe("Deployment", func() {

Context("problem occurs while reading from backup", func() {
BeforeEach(func() {
artifact.ReadFileReturns(nil, fmt.Errorf("an overrated clown"))
artifact.ReadFileReturns(nil, fmt.Errorf("a huge problem"))
})

It("fails", func() {
Expect(copyLocalBackupToRemoteError).To(HaveOccurred())
Expect(copyLocalBackupToRemoteError).To(MatchError("an overrated clown"))
Expect(copyLocalBackupToRemoteError).To(MatchError("a huge problem"))
})
})
})
Expand Down Expand Up @@ -1183,7 +1183,7 @@ var _ = Describe("Deployment", func() {

Describe("failures", func() {
Context("fails if backup cannot be drained", func() {
var drainError = fmt.Errorf("they are bringing crime")
var drainError = fmt.Errorf("please make it stop")

BeforeEach(func() {
backupBlob = new(fakes.FakeBackupBlob)
Expand All @@ -1201,7 +1201,7 @@ var _ = Describe("Deployment", func() {
})

Context("fails if file cannot be created", func() {
var fileError = fmt.Errorf("i have a very good brain")
var fileError = fmt.Errorf("not a good file")
BeforeEach(func() {
instances = []orchestrator.Instance{instance1}
instance1.BlobsToBackupReturns([]orchestrator.BackupBlob{backupBlob})
Expand Down Expand Up @@ -1235,7 +1235,7 @@ var _ = Describe("Deployment", func() {
})

Context("fails if the remote shasum cant be calulated", func() {
remoteShasumError := fmt.Errorf("i have created so many jobs")
remoteShasumError := fmt.Errorf("this shasum is not happy")
var writeCloser1 *fakes.FakeWriteCloser

BeforeEach(func() {
Expand Down
6 changes: 3 additions & 3 deletions orchestrator/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type ErrorCase struct {
}

var _ = Describe("Error", func() {
var genericError = errors.New("You are fake news")
var genericError = errors.New("Just a little error")

var lockError = orchestrator.NewLockError("LOCK_ERROR")
var backupError = orchestrator.NewBackupError("BACKUP_ERROR")
Expand Down Expand Up @@ -108,7 +108,7 @@ var _ = Describe("Error", func() {

Context("errors", func() {
errorCases := []ErrorCase{
{"genericError", []error{genericError}, 1, "You are fake news"},
{"genericError", []error{genericError}, 1, "borked"},
{"backupError", []error{backupError}, 1, "BACKUP_ERROR"},
{"lockError", []error{lockError}, 4, "LOCK_ERROR"},
{"unlockError", []error{postBackupUnlockError}, 8, "POST_BACKUP_ERROR"},
Expand Down Expand Up @@ -159,7 +159,7 @@ var _ = Describe("Error", func() {
It("returns exit code 17 (16 | 1)", func() {
exitCode, errorMessage := orchestrator.ProcessBackupError([]error{cleanupError, genericError})
Expect(exitCode).To(Equal(17))
Expect(errorMessage).To(ContainSubstring("You are fake news"))
Expect(errorMessage).To(ContainSubstring("Just a little error"))
Expect(errorMessage).To(ContainSubstring("CLEANUP_ERROR"))
})
})
Expand Down
Loading

0 comments on commit 09557b4

Please sign in to comment.