From e25dea4e4254d0f03e85c09d741dc5c259b45e0f Mon Sep 17 00:00:00 2001 From: Kyrre Havik Date: Mon, 28 Feb 2022 13:41:38 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20manglet=20feilh=C3=A5ndering=20i=20teste?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/config/kafka_environment_test.go | 9 ++++++--- pkg/secret/secret.go | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/config/kafka_environment_test.go b/pkg/config/kafka_environment_test.go index f34c3f9f..7470482d 100644 --- a/pkg/config/kafka_environment_test.go +++ b/pkg/config/kafka_environment_test.go @@ -1,6 +1,7 @@ package config import ( + "github.com/nais/cli/pkg/aiven" "github.com/nais/cli/pkg/consts" "github.com/nais/cli/pkg/test" "github.com/stretchr/testify/assert" @@ -22,7 +23,8 @@ func TestKafkaEnvironmentConfigGenerated(t *testing.T) { } tmpDest := test.SetupDest(t) - kcatConfig := NewEnvConfig(test.SetupSecret(envKeys), tmpDest) + kcatConfig, err := NewEnvConfig(test.SetupSecret(envKeys), tmpDest, aiven.Kafka) + assert.NoError(t, err) result, err := kcatConfig.Generate() assert.NoError(t, err) @@ -50,8 +52,9 @@ func TestKafkaEnvironmentSecrettMissingRequiredData(t *testing.T) { } tmpDest := test.SetupDest(t) - kcatConfig := NewEnvConfig(test.SetupSecret(envKeys), tmpDest) - _, err := kcatConfig.Generate() + kcatConfig, err := NewEnvConfig(test.SetupSecret(envKeys), tmpDest, aiven.Kafka) + assert.NoError(t, err) + _, err = kcatConfig.Generate() assert.EqualError(t, err, "can not generate kafka-secret.env config, secret missing required key: client.truststore.jks") defer os.Remove(tmpDest) diff --git a/pkg/secret/secret.go b/pkg/secret/secret.go index 9ede8921..1452b244 100644 --- a/pkg/secret/secret.go +++ b/pkg/secret/secret.go @@ -142,8 +142,11 @@ func (s *Secret) CreateKCatConfig() error { } func (s *Secret) CreateEnvConfig() error { - kafkaEnv := config.NewEnvConfig(s.Secret, s.DestinationPath, s.Service) - _, err := kafkaEnv.Generate() + kafkaEnv, err := config.NewEnvConfig(s.Secret, s.DestinationPath, s.Service) + if err != nil { + return err + } + _, err = kafkaEnv.Generate() if err != nil { return fmt.Errorf("generate %s config-type", s.ConfigType) }