-
Notifications
You must be signed in to change notification settings - Fork 2
/
main_test.go
35 lines (30 loc) · 931 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestParamToEnv(t *testing.T) {
for name, expected := range map[string]string{
"/a/b/ZERO": "ZERO",
"/a/b/ONE_ONE": "ONE_ONE",
"/a/b/two": "TWO",
"/a/b/three-three": "THREE_THREE",
"/a/b/FourFour": "FOURFOUR",
"/a/b/five five": "FIVE_FIVE",
"/a/b/Six!@#$%^&*()siX": "SIX__________SIX",
"/a/b/c/d/seven": "C_D_SEVEN",
"/a/b/eight8": "EIGHT8",
} {
assert.Equal(t, expected, paramToEnv(name, "/a/b"))
}
}
func TestArgvForExec(t *testing.T) {
argv, err := argvForExec([]string{"parameter-store-exec", "echo", "hello"})
require.NoError(t, err)
assert.Equal(t, []string{"echo", "hello"}, argv)
}
func TestArgvForExecError(t *testing.T) {
_, err := argvForExec([]string{"parameter-store-exec"})
assert.Error(t, err)
}