Skip to content

Commit

Permalink
Remove test code from..tests. (#4313)
Browse files Browse the repository at this point in the history
I instrumented one of the tests to inject a lot of entries to measure DB
query performance. I then promptly submitted the code without removing
it.
  • Loading branch information
jhrozek authored Aug 29, 2024
1 parent 4a80ebd commit e0376fe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
4 changes: 0 additions & 4 deletions internal/db/entities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ func Test_PropertyCrud(t *testing.T) {
const testRepoName = "testorg/testrepo_getbyprops"
const testArtifactName = "testorg/testartifact_getbyprops"

for i := 0; i < 50000; i++ {
createRandomEntity(t, proj.ID, prov.ID, EntitiesRepository)
}

repo, err := testQueries.CreateEntity(context.Background(), CreateEntityParams{
EntityType: EntitiesRepository,
Name: testRepoName,
Expand Down
39 changes: 0 additions & 39 deletions internal/db/projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,6 @@ import (
"github.com/stacklok/minder/internal/util/rand"
)

func createRandomEntity(t *testing.T, project uuid.UUID, provider uuid.UUID, entType Entities) {
t.Helper()

seed := time.Now().UnixNano()

ent, err := testQueries.CreateEntity(context.Background(), CreateEntityParams{
EntityType: entType,
Name: rand.RandomName(seed),
ProjectID: project,
ProviderID: provider,
OriginatedFrom: uuid.NullUUID{},
})
require.NoError(t, err)

prop, err := testQueries.UpsertPropertyValueV1(context.Background(), UpsertPropertyValueV1Params{
EntityID: ent.ID,
Key: "testkey1",
Value: rand.RandomName(seed),
})
require.NoError(t, err)
require.NotEmpty(t, prop)

prop, err = testQueries.UpsertPropertyValueV1(context.Background(), UpsertPropertyValueV1Params{
EntityID: ent.ID,
Key: "testkey1",
Value: rand.RandomName(seed),
})
require.NoError(t, err)
require.NotEmpty(t, prop)

prop, err = testQueries.UpsertPropertyValueV1(context.Background(), UpsertPropertyValueV1Params{
EntityID: ent.ID,
Key: "upstream_id",
Value: rand.RandomName(seed),
})
require.NoError(t, err)
require.NotEmpty(t, prop)
}

func createRandomProject(t *testing.T, orgID uuid.UUID) Project {
t.Helper()

Expand Down

0 comments on commit e0376fe

Please sign in to comment.