Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reliance on DNS resolution of *.localhost in tbot tests #43400

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/tbot/tbot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ type defaultBotConfigOpts struct {

func defaultTestServerOpts(t *testing.T, log *slog.Logger) testenv.TestServerOptFunc {
return func(o *testenv.TestServersOpts) {
testenv.WithClusterName(t, "root.localhost")(o)
testenv.WithClusterName(t, "root")(o)
marcoandredinis marked this conversation as resolved.
Show resolved Hide resolved
testenv.WithConfig(func(cfg *servicecfg.Config) {
cfg.Logger = log
cfg.Proxy.PublicAddrs = []utils.NetAddr{
{AddrNetwork: "tcp", Addr: net.JoinHostPort("root.localhost", strconv.Itoa(cfg.Proxy.WebAddr.Port(0)))},
{AddrNetwork: "tcp", Addr: net.JoinHostPort("localhost", strconv.Itoa(cfg.Proxy.WebAddr.Port(0)))},
}
})(o)
}
Expand Down Expand Up @@ -828,9 +828,9 @@ func TestBotSPIFFEWorkloadAPI(t *testing.T) {
require.NoError(t, err)

// SVID has successfully been issued. We can now assert that it's correct.
require.Equal(t, "spiffe://root.localhost/foo", svid.ID.String())
require.Equal(t, "spiffe://root/foo", svid.ID.String())
cert := svid.Certificates[0]
require.Equal(t, "spiffe://root.localhost/foo", cert.URIs[0].String())
require.Equal(t, "spiffe://root/foo", cert.URIs[0].String())
require.True(t, net.IPv4(10, 0, 0, 1).Equal(cert.IPAddresses[0]))
require.Equal(t, []string{"example.com"}, cert.DNSNames)
require.WithinRange(
Expand Down Expand Up @@ -972,7 +972,7 @@ func TestBotSSHMultiplexer(t *testing.T) {
cfg.SSH.Enabled = true
cfg.SSH.Addr = utils.NetAddr{
AddrNetwork: "tcp",
Addr: testenv.NewTCPListener(t, service.ListenerAuth, &cfg.FileDescriptors),
Addr: testenv.NewTCPListener(t, service.ListenerNodeSSH, &cfg.FileDescriptors),
}
}),
)
Expand Down Expand Up @@ -1057,9 +1057,9 @@ func TestBotSSHMultiplexer(t *testing.T) {
t.Cleanup(func() {
conn.Close()
})
_, err = fmt.Fprint(conn, "server01.root.localhost:0\x00")
_, err = fmt.Fprint(conn, "server01.root:0\x00")
require.NoError(t, err)
sshConn, sshChan, sshReq, err := ssh.NewClientConn(conn, "server01.root.localhost:22", sshConfig)
sshConn, sshChan, sshReq, err := ssh.NewClientConn(conn, "server01.root:22", sshConfig)
require.NoError(t, err)
sshClient := ssh.NewClient(sshConn, sshChan, sshReq)
t.Cleanup(func() {
Expand Down
Loading