Skip to content

Commit

Permalink
[sync-api] fixup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Aug 1, 2024
1 parent edc3b62 commit 4a68471
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 2 additions & 8 deletions sda/cmd/syncapi/syncapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,16 @@ func (suite *SyncAPITest) SetupTest() {
viper.Set("broker.port", mqPort)
viper.Set("broker.user", "guest")
viper.Set("broker.password", "guest")
viper.Set("broker.queue", "mappings")
viper.Set("broker.exchange", "amq.direct")
viper.Set("broker.vhost", "/")

viper.Set("schema.type", "isolated")
viper.Set("schema.type", "bigpicture")

viper.Set("sync.api.user", "dummy")
viper.Set("sync.api.password", "admin")
}

func (suite *SyncAPITest) TestSetup() {
suite.SetupTest()

func (suite *SyncAPITest) TestConfigSyncAPI() {
conf, err := config.NewConfig("sync-api")
assert.NoError(suite.T(), err, "Failed to setup config")
assert.Equal(suite.T(), mqPort, conf.Broker.Port)
Expand All @@ -136,7 +133,6 @@ func (suite *SyncAPITest) TestSetup() {
}

func (suite *SyncAPITest) TestShutdown() {
suite.SetupTest()
Conf, err = config.NewConfig("sync-api")
assert.NoError(suite.T(), err)

Expand All @@ -154,7 +150,6 @@ func (suite *SyncAPITest) TestShutdown() {
}

func (suite *SyncAPITest) TestReadinessResponse() {
suite.SetupTest()
Conf, err = config.NewConfig("sync-api")
assert.NoError(suite.T(), err)

Expand Down Expand Up @@ -199,7 +194,6 @@ func (suite *SyncAPITest) TestReadinessResponse() {
}

func (suite *SyncAPITest) TestDatasetRoute() {
suite.SetupTest()
Conf, err = config.NewConfig("sync-api")
assert.NoError(suite.T(), err)

Expand Down
2 changes: 2 additions & 0 deletions sda/internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func (suite *ConfigTestSuite) TestAPIConfiguration() {
assert.Nil(suite.T(), config)

// testing deafult values
suite.SetupTest()
config, err = NewConfig("api")
assert.NotNil(suite.T(), config)
assert.NoError(suite.T(), err)
Expand All @@ -224,6 +225,7 @@ func (suite *ConfigTestSuite) TestAPIConfiguration() {
assert.Equal(suite.T(), -1*time.Second, config.API.Session.Expiration)

viper.Reset()
suite.SetupTest()
// over write defaults
viper.Set("api.port", 8443)
viper.Set("api.session.secure", false)
Expand Down

0 comments on commit 4a68471

Please sign in to comment.