Skip to content

Commit

Permalink
🌱 Clean up stakeholders after Import CSV API test (#553)
Browse files Browse the repository at this point in the history
Fixes failing CI caused by Stakeholders lingering after the import test
completes.

Signed-off-by: Sam Lucidi <slucidi@redhat.com>
  • Loading branch information
mansam committed Nov 8, 2023
1 parent 57bb3f0 commit 24ac6f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/api/importcsv/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,20 @@ func TestImportCSV(t *testing.T) {

// Delete imported Applications.
for _, apps := range gotApps {
if apps.Owner != nil {
assert.Must(t, Stakeholder.Delete(apps.Owner.ID))
}
for _, contributor := range apps.Contributors {
assert.Must(t, Stakeholder.Delete(contributor.ID))
}
assert.Must(t, Application.Delete(apps.ID))
}

// Delete imported Dependencies.
for _, deps := range gotDeps {
assert.Must(t, Dependency.Delete(deps.ID))
}

})
}
}
4 changes: 4 additions & 0 deletions test/api/importcsv/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var (
Client *binding.Client
Application binding.Application
Dependency binding.Dependency
Stakeholder binding.Stakeholder
)

func init() {
Expand All @@ -24,4 +25,7 @@ func init() {

// Access Dependency directly
Dependency = RichClient.Dependency

// Access Stakeholder directly
Stakeholder = RichClient.Stakeholder
}

0 comments on commit 24ac6f4

Please sign in to comment.