-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathssm_test.go
126 lines (108 loc) · 2.73 KB
/
ssm_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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package internal
import (
"context"
"fmt"
"testing"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/stretchr/testify/assert"
)
func TestFindInstances(t *testing.T) {
assert := assert.New(t)
cfg, err := NewConfig(context.Background(), "", "", "", "", "")
assert.NoError(err)
tests := map[string]struct {
ctx context.Context
cfg aws.Config
isErr bool
}{
"success": {
ctx: context.Background(),
cfg: cfg,
isErr: false,
},
}
for _, t := range tests {
result, err := FindInstances(t.ctx, t.cfg)
assert.Equal(t.isErr, err != nil)
fmt.Println(len(result))
}
}
func TestFindInstanceIdsWithConnectedSSM(t *testing.T) {
assert := assert.New(t)
cfg, err := NewConfig(context.Background(), "", "", "", "", "")
assert.NoError(err)
tests := map[string]struct {
ctx context.Context
cfg aws.Config
isErr bool
}{
"success": {
ctx: context.Background(),
cfg: cfg,
isErr: false,
},
}
for _, t := range tests {
result, err := FindInstanceIdsWithConnectedSSM(t.ctx, t.cfg)
assert.Equal(t.isErr, err != nil)
fmt.Println(len(result))
}
}
func TestFindInstanceIdByIp(t *testing.T) {
assert := assert.New(t)
cfg, err := NewConfig(context.Background(), "", "", "", "", "")
assert.NoError(err)
tests := map[string]struct {
ctx context.Context
cfg aws.Config
ip string
isErr bool
}{
"success": {
ctx: context.Background(),
cfg: cfg,
ip: "1.1.1.1",
isErr: false,
},
}
for _, t := range tests {
result, err := FindInstanceIdByIp(t.ctx, t.cfg, t.ip)
assert.Equal(t.isErr, err != nil)
fmt.Println(result)
}
}
func TestFindDomainByInstanceId(t *testing.T) {
assert := assert.New(t)
cfg, err := NewConfig(context.Background(), "", "", "", "", "")
assert.NoError(err)
tests := map[string]struct {
ctx context.Context
cfg aws.Config
instanceId string
isErr bool
}{
"success": {
ctx: context.Background(),
cfg: cfg,
instanceId: "i-unknown",
isErr: false,
},
}
for _, t := range tests {
result, err := FindDomainByInstanceId(t.ctx, t.cfg, t.instanceId)
assert.Equal(t.isErr, err != nil)
fmt.Println(result)
}
}
func TestAskUser(t *testing.T) {}
func TestAskTeam(t *testing.T) {}
func TestAskRegion(t *testing.T) {}
func TestAskTarget(t *testing.T) {}
func TestAskMultiTarget(t *testing.T) {}
func TestAskPorts(t *testing.T) {}
func TestCreateStartSession(t *testing.T) {}
func TestDeleteStartSession(t *testing.T) {}
func TestSendCommand(t *testing.T) {}
func TestPrintCommandInvocation(t *testing.T) {}
func TestGenerateSSHExecCommand(t *testing.T) {}
func TestPrintReady(t *testing.T) {}