コード例 #1
0
ファイル: manager_test.go プロジェクト: emc-xchallenge/bbs
		It("it sorts the migrations and runs them sequentially", func() {
			Eventually(migrationProcess.Ready()).Should(BeClosed())
			Expect(migrationsDone).To(BeClosed())
			Consistently(fakeDB.SetVersionCallCount).Should(Equal(2))

			_, version := fakeDB.SetVersionArgsForCall(0)
			Expect(version).To(Equal(&models.Version{CurrentVersion: 99, TargetVersion: 102}))

			_, version = fakeDB.SetVersionArgsForCall(1)
			Expect(version).To(Equal(&models.Version{CurrentVersion: 102, TargetVersion: 102}))

			Expect(fakeMigration.UpCallCount()).To(Equal(1))
			Expect(fakeMigration102.UpCallCount()).To(Equal(1))

			Expect(fakeMigration.DownCallCount()).To(Equal(0))
			Expect(fakeMigration102.DownCallCount()).To(Equal(0))
		})

		It("sets the store client on the migration", func() {
			Eventually(migrationProcess.Ready()).Should(BeClosed())
			Expect(migrationsDone).To(BeClosed())
			Expect(fakeMigration.SetStoreClientCallCount()).To(Equal(1))
			actualStoreClient := fakeMigration.SetStoreClientArgsForCall(0)
			Expect(actualStoreClient).To(Equal(storeClient))
		})

		It("sets the cryptor on the migration", func() {
			Eventually(migrationProcess.Ready()).Should(BeClosed())
			Expect(migrationsDone).To(BeClosed())
			Expect(fakeMigration.SetCryptorCallCount()).To(Equal(1))