Skip to content

Commit

Permalink
fix agent endpoint test, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
valodzka committed Apr 20, 2023
1 parent 4f29f94 commit d0f3a1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions client/taskenv/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ func TestEnvironment_AsList(t *testing.T) {
},
},
}
a.AllocatedResources.Tasks["mail"] = &structs.AllocatedTaskResources{
Networks: []*structs.NetworkResource{
{
Device: "eth0",
IP: "fd12:3456:789a:1::1",
MBits: 50,
ReservedPorts: []structs.Port{
{Label: "ipv6", Value: 2222},
},
},
},
}
a.Namespace = "not-default"
task := a.Job.TaskGroups[0].Tasks[0]
task.Env = map[string]string{
Expand Down Expand Up @@ -220,6 +232,9 @@ func TestEnvironment_AsList(t *testing.T) {
"NOMAD_IP_ssh_ssh=192.168.0.100",
"NOMAD_PORT_ssh_other=1234",
"NOMAD_PORT_ssh_ssh=22",
"NOMAD_ADDR_mail_ipv6=[fd12:3456:789a:1::1]:2222",
"NOMAD_IP_mail_ipv6=fd12:3456:789a:1::1",
"NOMAD_PORT_mail_ipv6=2222",
"NOMAD_CPU_LIMIT=500",
"NOMAD_CPU_CORES=0,5-7",
"NOMAD_DC=dc1",
Expand Down
3 changes: 2 additions & 1 deletion command/agent/agent_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"net/url"
"os"
"reflect"
"strconv"
"strings"
"sync"
"syscall"
Expand Down Expand Up @@ -158,7 +159,7 @@ func TestHTTP_AgentJoin(t *testing.T) {
httpTest(t, nil, func(s *TestAgent) {
// Determine the join address
member := s.Agent.Server().LocalMember()
addr := net.JoinHostPort("%s:%d", member.Addr, member.Port)
addr := net.JoinHostPort(string(member.Addr), strconv.Itoa(int(member.Port)))

// Make the HTTP request
req, err := http.NewRequest("PUT",
Expand Down

0 comments on commit d0f3a1e

Please sign in to comment.