github.com/skippbox/kompose-origin@v0.0.0-20160524133224-16a9dca7bac2/lookup/simple_env_test.go (about)

     1  package lookup
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestOsEnvLookup(t *testing.T) {
     8  	// Putting bare minimun value for serviceName and config as there are
     9  	// not important on this test.
    10  	serviceName := "anything"
    11  
    12  	osEnvLookup := &OsEnvLookup{}
    13  
    14  	envs := osEnvLookup.Lookup("PATH", serviceName, nil)
    15  	if len(envs) != 1 {
    16  		t.Fatalf("Expected envs to contains one element, but was %v", envs)
    17  	}
    18  
    19  	envs = osEnvLookup.Lookup("path", serviceName, nil)
    20  	if len(envs) != 0 {
    21  		t.Fatalf("Expected envs to be empty, but was %v", envs)
    22  	}
    23  
    24  	envs = osEnvLookup.Lookup("DOES_NOT_EXIST", serviceName, nil)
    25  	if len(envs) != 0 {
    26  		t.Fatalf("Expected envs to be empty, but was %v", envs)
    27  	}
    28  }