Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Reverse lookup tenant by cluster/namespace (openshiftio/openshiftio#1389) #476

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions tenant/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/fabric8-services/fabric8-tenant/tenant"
"github.com/fabric8-services/fabric8-tenant/test/gormsupport"
"github.com/fabric8-services/fabric8-tenant/test/resource"
"github.com/fabric8-services/fabric8-tenant/test/testfixture"
tf "github.com/fabric8-services/fabric8-tenant/test/testfixture"
"github.com/fabric8-services/fabric8-wit/errors"
uuid "github.com/satori/go.uuid"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -44,7 +44,7 @@ func (s *TenantServiceTestSuite) TestCreateTenant() {
svc := tenant.NewDBService(s.DB)
tenant := &tenant.Tenant{
Email: "joe@foo.com",
Profile: "unknown",
Profile: "free",
}
// when
err := svc.SaveTenant(tenant)
Expand All @@ -68,9 +68,10 @@ func (s *TenantServiceTestSuite) TestCreateTenant() {
}

func (s *TenantServiceTestSuite) TestUpdateTenant() {

s.T().Run("ok", func(t *testing.T) {
// given
fxt := testfixture.NewTestFixture(s.T(), s.DB, testfixture.Tenants(1))
fxt := tf.NewTestFixture(t, s.DB, tf.Tenants(1))
svc := tenant.NewDBService(s.DB)
tenant := fxt.Tenants[0]
// when
Expand All @@ -82,7 +83,7 @@ func (s *TenantServiceTestSuite) TestUpdateTenant() {

s.T().Run("ko - invalid profile", func(t *testing.T) {
// given
fxt := testfixture.NewTestFixture(s.T(), s.DB, testfixture.Tenants(1))
fxt := tf.NewTestFixture(t, s.DB, tf.Tenants(1))
svc := tenant.NewDBService(s.DB)
tenant := fxt.Tenants[0]
// when
Expand All @@ -96,7 +97,7 @@ func (s *TenantServiceTestSuite) TestUpdateTenant() {
func (s *TenantServiceTestSuite) TestLookupTenantByNamespace() {
s.T().Run("ok", func(t *testing.T) {
// given
fxt := testfixture.NewTestFixture(s.T(), s.DB, testfixture.Tenants(1), testfixture.Namespaces(1))
fxt := tf.NewTestFixture(t, s.DB, tf.Tenants(1), tf.Namespaces(1))
svc := tenant.NewDBService(s.DB)
ns := fxt.Namespaces[0]
// when
Expand Down
2 changes: 1 addition & 1 deletion test/testfixture/make_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func makeNamespaces(fxt *TestFixture) error {
tenantService := tenant.NewDBService(fxt.db)
for i := range fxt.Namespaces {
fxt.Namespaces[i] = &tenant.Namespace{
Type: tenant.TypeUser,
Type: tenant.TypeChe,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the default type should be here but I trust you.

Name: createRandomNamespaceName(),
MasterURL: "some.cluster.url",
}
Expand Down