Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm committed Sep 13, 2024
1 parent aaa13bb commit caca34f
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions internal/install/application_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,43 @@ import (
func TestSelectElasticAgentImageName_NoVersion(t *testing.T) {
var version string
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentLegacyImageName)
assert.Equal(t, elasticAgentWolfiImageName, selected)
}

func TestSelectElasticAgentImageName_OlderStack(t *testing.T) {
version := "7.14.99-SNAPSHOT"
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentLegacyImageName)
assert.Equal(t, elasticAgentLegacyImageName, selected)
}

func TestSelectElasticAgentImageName_FirstStackWithCompleteAgent(t *testing.T) {
version := stackVersion715
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentCompleteLegacyImageName)
assert.Equal(t, elasticAgentCompleteLegacyImageName, selected)
}

func TestSelectElasticAgentImageName_NextStackWithAgentComplete(t *testing.T) {
version := "7.16.0-SNAPSHOT"
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentCompleteLegacyImageName)
assert.Equal(t, elasticAgentCompleteLegacyImageName, selected)
}

func TestSelectElasticAgentImageName_OwnNamespace(t *testing.T) {
version := "8.2.0-SNAPSHOT"
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentCompleteImageName)
assert.Equal(t, elasticAgentCompleteImageName, selected)
}

func TestSelectElasticAgentImageName_OwnNamespace_Release(t *testing.T) {
version := "8.2.0"
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentCompleteImageName)
assert.Equal(t, elasticAgentCompleteImageName, selected)
}

func TestSelectElasticAgentImageName_NextStackInOwnNamespace(t *testing.T) {
version := "8.4.0-SNAPSHOT"
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentCompleteImageName)
assert.Equal(t, elasticAgentCompleteImageName, selected)
}

func TestSelectElasticAgentImageName_DefaultImage816_WithoutEnvVar(t *testing.T) {
Expand All @@ -60,56 +60,56 @@ func TestSelectElasticAgentImageName_DefaultImage816_WithoutEnvVar(t *testing.T)
os.Unsetenv(disableElasticAgentWolfiEnvVar)

selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentWolfiImageName)
assert.Equal(t, elasticAgentWolfiImageName, selected)
}

func TestSelectElasticAgentImageName_DisableWolfiImageEnvVar(t *testing.T) {
version := stackVersion8160
t.Setenv(disableElasticAgentWolfiEnvVar, "true")
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentCompleteImageName)
assert.Equal(t, elasticAgentCompleteImageName, selected)
}
func TestSelectElasticAgentImageName_EnableWolfiImageEnvVar(t *testing.T) {
version := stackVersion8160
t.Setenv(disableElasticAgentWolfiEnvVar, "false")
selected := selectElasticAgentImageName(version, "")
assert.Equal(t, selected, elasticAgentWolfiImageName)
assert.Equal(t, elasticAgentWolfiImageName, selected)
}

func TestSelectCompleteElasticAgentImageName_ForceCompleteImage(t *testing.T) {
version := stackVersion8160
selected := selectElasticAgentImageName(version, "complete")
assert.Equal(t, selected, elasticAgentCompleteImageName)
assert.Equal(t, elasticAgentCompleteImageName, selected)
}

func TestSelectCompleteElasticAgentImageName_ForceDefaultImage_DisabledEnvVar(t *testing.T) {
version := stackVersion8160
t.Setenv(disableElasticAgentWolfiEnvVar, "true")
selected := selectElasticAgentImageName(version, "default")
assert.Equal(t, selected, elasticAgentCompleteImageName)
assert.Equal(t, elasticAgentCompleteImageName, selected)
}

func TestSelectCompleteElasticAgentImageName_ForceDefaultImage_EnabledEnvVar(t *testing.T) {
version := stackVersion8160
t.Setenv(disableElasticAgentWolfiEnvVar, "false")
selected := selectElasticAgentImageName(version, "default")
assert.Equal(t, selected, elasticAgentWolfiImageName)
assert.Equal(t, elasticAgentWolfiImageName, selected)
}

func TestSelectCompleteElasticAgentImageName_ForceDefaultImageOldStack(t *testing.T) {
version := "8.15.0-SNAPSHOT"
selected := selectElasticAgentImageName(version, "default")
assert.Equal(t, selected, elasticAgentCompleteImageName)
assert.Equal(t, elasticAgentCompleteImageName, selected)
}

func TestSelectCompleteElasticAgentImageName_ForceSystemDImage(t *testing.T) {
version := stackVersion8160
selected := selectElasticAgentImageName(version, "systemd")
assert.Equal(t, selected, elasticAgentImageName)
assert.Equal(t, elasticAgentImageName, selected)
}

func TestSelectCompleteElasticAgentImageName_ForceSystemDImageOldStack(t *testing.T) {
version := stackVersion715
selected := selectElasticAgentImageName(version, "systemd")
assert.Equal(t, selected, elasticAgentLegacyImageName)
assert.Equal(t, elasticAgentLegacyImageName, selected)
}

0 comments on commit caca34f

Please sign in to comment.