Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions build.assets/charts/Dockerfile-distroless
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ FROM $BASE_IMAGE
COPY --from=teleport /opt/staging /
COPY --from=staging /opt/staging/root /
COPY --from=staging /opt/staging/status /var/lib/dpkg/status.d
ENV TELEPORT_TOOLS_VERSION=off
ENTRYPOINT ["/usr/bin/dumb-init", "/usr/local/bin/teleport", "start", "-c", "/etc/teleport/teleport.yaml"]
25 changes: 18 additions & 7 deletions integration/autoupdate/tools/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"testing"
Expand Down Expand Up @@ -59,8 +58,13 @@ func TestUpdate(t *testing.T) {
err := updater.Update(ctx, testVersions[0])
require.NoError(t, err)

tshPath, err := updater.ToolPath("tsh", testVersions[0])
require.NoError(t, err)
tctlPath, err := updater.ToolPath("tctl", testVersions[0])
require.NoError(t, err)

// Verify that the installed version is equal to requested one.
cmd := exec.CommandContext(ctx, filepath.Join(toolsDir, "tctl"), "version")
cmd := exec.CommandContext(ctx, tctlPath, "version")
out, err := cmd.Output()
require.NoError(t, err)

Expand All @@ -70,7 +74,7 @@ func TestUpdate(t *testing.T) {

// Execute version command again with setting the new version which must
// trigger re-execution of the same command after downloading requested version.
cmd = exec.CommandContext(ctx, filepath.Join(toolsDir, "tsh"), "version")
cmd = exec.CommandContext(ctx, tshPath, "version")
cmd.Env = append(
os.Environ(),
fmt.Sprintf("%s=%s", teleportToolsVersion, testVersions[1]),
Expand Down Expand Up @@ -100,6 +104,9 @@ func TestParallelUpdate(t *testing.T) {
err := updater.Update(ctx, testVersions[0])
require.NoError(t, err)

tshPath, err := updater.ToolPath("tsh", testVersions[0])
require.NoError(t, err)

// By setting the limit request next test http serving file going blocked until unlock is sent.
lock := make(chan struct{})
limitedWriter.SetLimitRequest(limitRequest{
Expand All @@ -109,8 +116,8 @@ func TestParallelUpdate(t *testing.T) {

outputs := make([]bytes.Buffer, 3)
errChan := make(chan error, 3)
for i := 0; i < len(outputs); i++ {
cmd := exec.Command(filepath.Join(toolsDir, "tsh"), "version")
for i := range outputs {
cmd := exec.Command(tshPath, "version")
cmd.Stdout = &outputs[i]
cmd.Stderr = &outputs[i]
cmd.Env = append(
Expand Down Expand Up @@ -172,9 +179,11 @@ func TestUpdateInterruptSignal(t *testing.T) {
)
err := updater.Update(ctx, testVersions[0])
require.NoError(t, err)
tshPath, err := updater.ToolPath("tsh", testVersions[0])
require.NoError(t, err)

var output bytes.Buffer
cmd := exec.Command(filepath.Join(toolsDir, "tsh"), "version")
cmd := exec.Command(tshPath, "version")
cmd.Stdout = &output
cmd.Stderr = &output
cmd.Env = append(
Expand Down Expand Up @@ -236,9 +245,11 @@ func TestUpdateForOSSBuild(t *testing.T) {
)
err := updater.Update(ctx, testVersions[0])
require.NoError(t, err)
tshPath, err := updater.ToolPath("tsh", testVersions[0])
require.NoError(t, err)

// Verify that requested update is not ignored by OSS build type and version is updated.
cmd := exec.CommandContext(ctx, filepath.Join(toolsDir, "tsh"), "version")
cmd := exec.CommandContext(ctx, tshPath, "version")
cmd.Env = append(
os.Environ(),
fmt.Sprintf("%s=%s", teleportToolsVersion, testVersions[1]),
Expand Down
Loading
Loading