Skip to content

Commit

Permalink
fix: remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jinghancc committed Nov 15, 2021
1 parent 0a3a4d7 commit 4761092
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 64 deletions.
15 changes: 0 additions & 15 deletions internal/database/metadata/postgres/feature_group_test.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
package postgres_test

import (
"context"
"testing"

"github.com/oom-ai/oomstore/internal/database/metadata"
"github.com/oom-ai/oomstore/internal/database/metadata/postgres"
"github.com/oom-ai/oomstore/internal/database/metadata/test"
"github.com/stretchr/testify/require"
)

// create an entity with given name
func prepareEntity(t *testing.T, ctx context.Context, db *postgres.DB, name string) int16 {
entityId, err := db.CreateEntity(ctx, metadata.CreateEntityOpt{
Name: name,
Length: 32,
Description: "description",
})
require.NoError(t, err)
return entityId
}

func TestGetFeatureGroup(t *testing.T) {
test.TestGetFeatureGroup(t, prepareStore)
}
Expand Down
24 changes: 0 additions & 24 deletions internal/database/metadata/postgres/feature_test.go
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
package postgres_test

import (
"context"
"testing"

"github.com/oom-ai/oomstore/internal/database/metadata"
"github.com/oom-ai/oomstore/internal/database/metadata/postgres"
"github.com/oom-ai/oomstore/internal/database/metadata/test"
"github.com/oom-ai/oomstore/pkg/oomstore/types"
"github.com/stretchr/testify/require"
)

func prepareEntityAndGroup(t *testing.T, ctx context.Context, db *postgres.DB) (int16, int16) {
entityID, err := db.CreateEntity(ctx, metadata.CreateEntityOpt{
Name: "device",
Length: 32,
Description: "description",
})
require.NoError(t, err)

groupID, err := db.CreateFeatureGroup(ctx, metadata.CreateFeatureGroupOpt{
Name: "device_info",
EntityID: entityID,
Description: "description",
Category: types.BatchFeatureCategory,
})
require.NoError(t, err)
require.NoError(t, db.Refresh())
return entityID, groupID
}

func TestCreateFeature(t *testing.T) {
test.TestCreateFeature(t, prepareStore)
}
Expand Down
4 changes: 0 additions & 4 deletions internal/database/metadata/test/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ func int16Ptr(i int16) *int16 {
return &i
}

func int32Ptr(i int32) *int32 {
return &i
}

func stringPtr(s string) *string {
return &s
}
2 changes: 1 addition & 1 deletion pkg/oomstore/feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ device,model,price
})
metadataStore.EXPECT().
GetFeatureGroup(gomock.Any(), int16(1)).
Return(&types.FeatureGroup{ID: 1, EntityID: 1, Entity: &typesv2.Entity{Name: "device"}}, nil)
Return(&types.FeatureGroup{ID: 1, EntityID: 1, Entity: &types.Entity{Name: "device"}}, nil)
metadataStore.EXPECT().
GetEntity(gomock.Any(), int16(1)).
Return(&types.Entity{Name: "device"}, nil)
Expand Down
20 changes: 0 additions & 20 deletions pkg/oomstore/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,22 +202,6 @@ func TestSync(t *testing.T) {
}
}

func prepareRevision(id int32, revision int64) types.Revision {
return types.Revision{
ID: id,
Revision: revision,
GroupID: 1,
DataTable: fmt.Sprintf("device_info_%d", revision),
}
}
func prepareGroup(revisionId *int32) types.FeatureGroup {
return types.FeatureGroup{
Name: "device_info",
OnlineRevisionID: revisionId,
EntityID: 1,
}
}

func int16Ptr(i int16) *int16 {
return &i
}
Expand All @@ -229,7 +213,3 @@ func int32Ptr(i int32) *int32 {
func stringPtr(s string) *string {
return &s
}

func boolPtr(b bool) *bool {
return &b
}

0 comments on commit 4761092

Please sign in to comment.