From 4a684716db4e493df82a9963670e49491bc222b8 Mon Sep 17 00:00:00 2001 From: Joakim Bygdell Date: Thu, 1 Aug 2024 10:55:50 +0200 Subject: [PATCH] [sync-api] fixup tests --- sda/cmd/syncapi/syncapi_test.go | 10 ++-------- sda/internal/config/config_test.go | 2 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sda/cmd/syncapi/syncapi_test.go b/sda/cmd/syncapi/syncapi_test.go index c358acb2c..ecdeaae91 100644 --- a/sda/cmd/syncapi/syncapi_test.go +++ b/sda/cmd/syncapi/syncapi_test.go @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/sda/internal/config/config_test.go b/sda/internal/config/config_test.go index fcf49c931..31dcb4669 100644 --- a/sda/internal/config/config_test.go +++ b/sda/internal/config/config_test.go @@ -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) @@ -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)