github.com/in4it/ecs-deploy@v0.0.42-0.20240508120354-ed77ff16df25/provider/ecs/paramstore_test.go (about)

     1  package ecs
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  )
     7  
     8  func TestGetPrefix(t *testing.T) {
     9  	p := Paramstore{}
    10  	os.Setenv("AWS_ENV_PATH", "/mycompany-staging/ecs-deploy/")
    11  	os.Setenv("PARAMSTORE_PREFIX", "mycompany2")
    12  	os.Setenv("AWS_ACCOUNT_ENV", "prod")
    13  	if p.GetPrefix() != "/mycompany-staging/ecs-deploy/" {
    14  		t.Errorf("Wrong prefix returned: %v", p.GetPrefix())
    15  	}
    16  	os.Setenv("AWS_ENV_PATH", "")
    17  	if p.GetPrefix() != "/mycompany2-prod/ecs-deploy/" {
    18  		t.Errorf("Wrong prefix returned: %v", p.GetPrefix())
    19  	}
    20  }