You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/api/internal/upgrade/upgrade_docker_test.go

30 lines
766 B

package upgrade
import (
"os"
"testing"
portainer "github.com/portainer/portainer/api"
)
func TestGetUpdaterImage(t *testing.T) {
t.Run("updater image Environment Variable is set", func(t *testing.T) {
os.Setenv(updaterImageEnvVar, "portainer/portainer-updater:pr111")
expect := "portainer/portainer-updater:pr111"
updaterImage := getUpdaterImage()
if updaterImage != expect {
t.Fatalf("expected %v, got %v", expect, updaterImage)
}
})
t.Run("updater image Environment Variable not set", func(t *testing.T) {
os.Unsetenv(updaterImageEnvVar)
expect := "portainer/portainer-updater:" + portainer.APIVersion
updaterImage := getUpdaterImage()
if updaterImage != expect {
t.Fatalf("expected %v, got %v", expect, updaterImage)
}
})
}