Skip to content

Commit

Permalink
test: the format function is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zucchinidev committed Aug 21, 2024
1 parent 1ed9bb1 commit 451c001
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions integrationtest/import_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ var _ = Describe("Import State", func() {

By("checking that the state is empty")
var d models.TerraformDeployment
Expect(dbConn.Where("id = ?", fmt.Sprintf("tf:%s:", instance.GUID)).First(&d).Error).To(Succeed())
terraformDeploymentID := fmt.Sprintf("tf:%s:", instance.GUID)
Expect(dbConn.Where("id = ?", terraformDeploymentID).First(&d).Error).To(Succeed())
var w workspace.TerraformWorkspace
Expect(json.Unmarshal(d.Workspace, &w)).To(Succeed())
Expect(w.State).To(MatchJSON(`{"version":4}`))

By("checking that the `vacant` parameter was not stored")
var i models.ProvisionRequestDetails
Expect(dbConn.Where("service_instance_id = ?", fmt.Sprintf(instance.GUID)).First(&i).Error).To(Succeed())
Expect(dbConn.Where("service_instance_id = ?", instance.GUID).First(&i).Error).To(Succeed())
Expect(i.RequestDetails).To(MatchJSON(`{}`))

By("importing state into the vacant service instance")
Expand All @@ -66,7 +67,7 @@ var _ = Describe("Import State", func() {
Expect(importResponse).To(HaveHTTPStatus(http.StatusOK))

By("checking that the state was imported into the database")
Expect(dbConn.Where("id = ?", fmt.Sprintf("tf:%s:", instance.GUID)).First(&d).Error).To(Succeed())
Expect(dbConn.Where("id = ?", terraformDeploymentID).First(&d).Error).To(Succeed())
Expect(json.Unmarshal(d.Workspace, &w)).To(Succeed())
Expect(w.State).To(MatchJSON(stateToImport))

Expand Down

0 comments on commit 451c001

Please sign in to comment.