Skip to content

Commit

Permalink
fix: reconciliation test
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Nov 10, 2024
1 parent 99432d8 commit 862e452
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/upstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ var _ = ginkgo.Describe("Reconcile Test", ginkgo.Ordered, ginkgo.Label("slow"),
}
})

ginkgo.It("should sync config scrapers", func() {
{
var pushed int
err := DefaultContext.DB().Select("COUNT(*)").Where("is_pushed = true").Model(&models.ConfigScraper{}).Scan(&pushed).Error
Expect(err).ToNot(HaveOccurred())
Expect(pushed).To(BeZero())
}

summary := upstream.ReconcileSome(DefaultContext, upstreamConf, 100, "config_scrapers")
Expect(summary.Error()).To(BeNil())
count, fkFailed := summary.GetSuccessFailure()
Expect(fkFailed).To(Equal(0))
Expect(count).To(Equal(2))

var totalConfigScrapersPushed int
err := upstreamCtx.DB().Select("COUNT(*)").Model(&models.ConfigScraper{}).Scan(&totalConfigScrapersPushed).Error
Expect(err).ToNot(HaveOccurred())
Expect(totalConfigScrapersPushed).To(Equal(count))
})

ginkgo.It("should sync config items to upstream & deal with fk issue", func() {
{
var pushed int
Expand Down

0 comments on commit 862e452

Please sign in to comment.