Skip to content

Commit

Permalink
add target tests for user and custom port
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed May 10, 2023
1 parent b3e7931 commit 293b8d4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/config/target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func TestDestinations(t *testing.T) {
inventory: &InventoryData{
Groups: map[string][]Destination{
allHostsGrp: {
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server2", Host: "192.168.1.2", Tags: []string{"db"}},
{Name: "server1", Host: "192.168.1.1", Port: 22, Tags: []string{"web"}},
{Name: "server2", Host: "192.168.1.2", Port: 2222, Tags: []string{"db"}},
},
},
},
expected: []Destination{
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server1", Host: "192.168.1.1", Port: 22, Tags: []string{"web"}},
},
err: false,
},
Expand Down Expand Up @@ -97,19 +97,19 @@ func TestDestinations(t *testing.T) {
inventory: &InventoryData{
Groups: map[string][]Destination{
allHostsGrp: {
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server1", Host: "192.168.1.1", Port: 2222, Tags: []string{"web"}},
{Name: "server2", Host: "192.168.1.2", Tags: []string{"db"}},
},
"web": {
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server1", Host: "192.168.1.1", Port: 2222, Tags: []string{"web"}},
},
"db": {
{Name: "server2", Host: "192.168.1.2", Tags: []string{"db"}},
},
},
},
expected: []Destination{
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server1", Host: "192.168.1.1", Port: 2222, Tags: []string{"web"}},
},
err: false,
},
Expand Down Expand Up @@ -147,11 +147,11 @@ func TestDestinations(t *testing.T) {
inventory: &InventoryData{
Groups: map[string][]Destination{
allHostsGrp: {
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}, Port: 2222, User: "user2"},
{Name: "server2", Host: "192.168.1.2", Tags: []string{"db"}},
},
"web": {
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}, Port: 2222, User: "user2"},
},
"db": {
{Name: "server2", Host: "192.168.1.2", Tags: []string{"db"}},
Expand All @@ -160,7 +160,7 @@ func TestDestinations(t *testing.T) {
},
expected: []Destination{
{Name: "host1", Host: "192.168.1.3"},
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}},
{Name: "server1", Host: "192.168.1.1", Tags: []string{"web"}, Port: 2222, User: "user2"},
{Name: "server2", Host: "192.168.1.2", Tags: []string{"db"}},
},
err: false,
Expand Down

0 comments on commit 293b8d4

Please sign in to comment.