Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
s12v committed Dec 9, 2018
1 parent 895fa47 commit 542ec8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions provider/awsssm/awsssm.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ func (p *SsmProvider) Decode(val string) (string, error) {
name := val[len(prefix):]
var withEncryption = true
input := &ssm.GetParameterInput{Name: &name, WithDecryption: &withEncryption}
fmt.Printf("name: %v\n", name)
if err := input.Validate(); err != nil {
return val, nil
return val, err
}

if output, err := fetch(p.awsSSmClient, input); err != nil {
Expand Down
7 changes: 7 additions & 0 deletions provider/awsssm/awsssm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ func TestSsmProvider_Decode(t *testing.T) {
t.Fatalf("unexpected plaintext %v", r)
}
}

func TestSsmProvider_DecodeInvalidInput(t *testing.T) {
ssmProvider := SsmProvider{}
if r, err := ssmProvider.Decode("{aws-ssm}"); err == nil {
t.Fatal("expected an error", r)
}
}

0 comments on commit 542ec8f

Please sign in to comment.