コード例 #1
0
ファイル: manager_test.go プロジェクト: timani/bbs
					Expect(version).To(Equal(&models.Version{CurrentVersion: 99, TargetVersion: 102}))

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

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

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

				It("sets the raw SQL db and the storeClient on the migration to SQL", func() {
					Eventually(migrationProcess.Ready()).Should(BeClosed())
					Expect(migrationsDone).To(BeClosed())
					Expect(fakeMigrationToSQL.SetRawSQLDBCallCount()).To(Equal(1))
					Expect(fakeMigrationToSQL.SetStoreClientCallCount()).To(Equal(1))
				})
			})

			Context("etcd to sql has already been run", func() {
				var fakeMigrationToSQL *migrationfakes.FakeMigration

				BeforeEach(func() {
					fakeMigrationToSQL = &migrationfakes.FakeMigration{}
					fakeMigrationToSQL.VersionReturns(103)
					fakeMigrationToSQL.RequiresSQLReturns(true)

					// Current Version is 1 more than the last ETCD Migration (99)
					dbVersion.CurrentVersion = 100
					dbVersion.TargetVersion = 103