Skip to content

Commit

Permalink
Revert "Fix backup table ordering tests (#51)"
Browse files Browse the repository at this point in the history
This reverts commit e430fe2 to solve conflicts
with 12bca9e.
  • Loading branch information
RekGRpth committed Jul 16, 2024
1 parent 34aef72 commit 82fd612
Showing 1 changed file with 7 additions and 52 deletions.
59 changes: 7 additions & 52 deletions integration/wrappers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ var _ = Describe("Wrappers Integration", func() {
Describe("RetrieveAndProcessTables", func() {
BeforeEach(func() {
rootCmd := &cobra.Command{}
includes := []string{"--include-table", "public.foo", "--include-table", "public.BAR"}
rootCmd.SetArgs(options.HandleSingleDashes(includes))
backup.DoInit(rootCmd) // initialize the ObjectCount
rootCmd.Execute()
})
It("returns the data tables that have names with special characters", func() {
_ = backupCmdFlags.Set(options.INCLUDE_RELATION, "public.foo")
_ = backupCmdFlags.Set(options.INCLUDE_RELATION, "public.BAR")

testhelper.AssertQueryRuns(connectionPool, "CREATE TABLE public.foo(i int); INSERT INTO public.foo VALUES (1);")
testhelper.AssertQueryRuns(connectionPool, `CREATE TABLE public."BAR"(i int); INSERT INTO public."BAR" VALUES (1);`)
defer testhelper.AssertQueryRuns(connectionPool, "DROP TABLE public.foo;")
Expand Down Expand Up @@ -63,10 +63,6 @@ var _ = Describe("Wrappers Integration", func() {
rootCmd := &cobra.Command{}
backup.DoInit(rootCmd) // initialize the ObjectCount

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expect(len(dataTables)).To(Equal(3))
Expect(dataTables[0].Name).To(Equal("thousands"))
Expand All @@ -80,13 +76,6 @@ var _ = Describe("Wrappers Integration", func() {
backup.DoInit(rootCmd) // initialize the ObjectCount
rootCmd.Execute()

_ = backupCmdFlags.Set(options.INCLUDE_RELATION, "public.empty")
_ = backupCmdFlags.Set(options.INCLUDE_RELATION, "public.ten")

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expect(len(dataTables)).To(Equal(2))
Expect(dataTables[0].Name).To(Equal("ten"))
Expand All @@ -99,12 +88,6 @@ var _ = Describe("Wrappers Integration", func() {
backup.DoInit(rootCmd) // initialize the ObjectCount
rootCmd.Execute()

_ = backupCmdFlags.Set(options.EXCLUDE_RELATION, "public.thousands")

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expect(len(dataTables)).To(Equal(2))
Expect(dataTables[0].Name).To(Equal("ten"))
Expand Down Expand Up @@ -136,12 +119,6 @@ var _ = Describe("Wrappers Integration", func() {
backup.DoInit(rootCmd) // initialize the ObjectCount
rootCmd.Execute()

_ = backupCmdFlags.Set(options.INCLUDE_SCHEMA, "filterschema")

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expect(len(dataTables)).To(Equal(2))
Expect(dataTables[0].Name).To(Equal("thousands"))
Expand All @@ -154,12 +131,6 @@ var _ = Describe("Wrappers Integration", func() {
backup.DoInit(rootCmd) // initialize the ObjectCount
rootCmd.Execute()

_ = backupCmdFlags.Set(options.EXCLUDE_SCHEMA, "public")

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expect(len(dataTables)).To(Equal(2))
Expect(dataTables[0].Name).To(Equal("thousands"))
Expand Down Expand Up @@ -193,12 +164,8 @@ var _ = Describe("Wrappers Integration", func() {
rootCmd := &cobra.Command{}
backup.DoInit(rootCmd) // initialize the ObjectCount

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

includeOids := backup.GetOidsFromRelationList(backup.IncludedRelationFqns)
err = backup.ExpandIncludesForPartitions(connectionPool, subject, includeOids, backupCmdFlags)
opts, _ := options.NewOptions(rootCmd.Flags())
err := opts.ExpandIncludesForPartitions(connectionPool, rootCmd.Flags())
Expect(err).ShouldNot(HaveOccurred())

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expand All @@ -213,12 +180,8 @@ var _ = Describe("Wrappers Integration", func() {
backup.DoInit(rootCmd) // initialize the ObjectCount
rootCmd.Execute()

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

includeOids := backup.GetOidsFromRelationList(backup.IncludedRelationFqns)
err = backup.ExpandIncludesForPartitions(connectionPool, subject, includeOids, backupCmdFlags)
opts, _ := options.NewOptions(rootCmd.Flags())
err := opts.ExpandIncludesForPartitions(connectionPool, rootCmd.Flags())
Expect(err).ShouldNot(HaveOccurred())

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expand Down Expand Up @@ -252,10 +215,6 @@ var _ = Describe("Wrappers Integration", func() {
rootCmd := &cobra.Command{}
backup.DoInit(rootCmd) // initialize the ObjectCount

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expect(len(dataTables)).To(Equal(3))

Expand All @@ -275,10 +234,6 @@ var _ = Describe("Wrappers Integration", func() {
rootCmd := &cobra.Command{}
backup.DoInit(rootCmd) // initialize the ObjectCount

subject, err := options.NewOptions(backupCmdFlags)
Expect(err).To(Not(HaveOccurred()))
backup.ValidateAndProcessFilterLists(subject)

_, dataTables, _ := backup.RetrieveAndProcessTables()
Expect(len(dataTables)).To(Equal(3))

Expand Down

0 comments on commit 82fd612

Please sign in to comment.