From 440215b811e7888fbd6a4f13ac2aed4378a77fb8 Mon Sep 17 00:00:00 2001 From: Pavel Sviderski Date: Wed, 23 Apr 2025 16:10:40 +1000 Subject: [PATCH] fix: TestInstallCmd test --- internal/cli/machine_test.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/internal/cli/machine_test.go b/internal/cli/machine_test.go index ec1bfd76..b43717b4 100644 --- a/internal/cli/machine_test.go +++ b/internal/cli/machine_test.go @@ -8,12 +8,29 @@ import ( func TestInstallCmd(t *testing.T) { t.Run("root", func(t *testing.T) { - cmd := installCmd("root") + cmd := installCmd("root", "") assert.NotContains(t, cmd, "sudo") + assert.NotContains(t, cmd, "UNCLOUD_GROUP_ADD_USER") + }) + + // Test with version + t.Run("root with version", func(t *testing.T) { + cmd := installCmd("root", "v1.2.3") + assert.NotContains(t, cmd, "sudo") + assert.NotContains(t, cmd, "UNCLOUD_GROUP_ADD_USER") + assert.Contains(t, cmd, "UNCLOUD_VERSION=v1.2.3") }) t.Run("nonroot", func(t *testing.T) { - cmd := installCmd("nonroot") + cmd := installCmd("nonroot", "") assert.Contains(t, cmd, "sudo") + assert.Contains(t, cmd, "UNCLOUD_GROUP_ADD_USER=nonroot") + }) + + t.Run("nonroot with version", func(t *testing.T) { + cmd := installCmd("nonroot", "v1.2.3") + assert.Contains(t, cmd, "sudo") + assert.Contains(t, cmd, "UNCLOUD_GROUP_ADD_USER=nonroot") + assert.Contains(t, cmd, "UNCLOUD_VERSION=v1.2.3") }) }