github.com/misfo/deis@v1.0.1-0.20141111224634-e0eee0392b8a/publisher/server/publisher_test.go (about)

     1  package server
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestIsPublishableApp(t *testing.T) {
     8  	s := &Server{nil, nil}
     9  	appName := "go_v2.web.1"
    10  	if !s.IsPublishableApp(appName) {
    11  		t.Errorf("%s should be publishable", appName)
    12  	}
    13  	badAppName := "go_v2"
    14  	if s.IsPublishableApp(badAppName) {
    15  		t.Errorf("%s should not be publishable", badAppName)
    16  	}
    17  	// publisher assumes that an app name of "test" with a null etcd client has v3 running
    18  	oldVersion := "ceci-nest-pas-une-app_v2.web.1"
    19  	if s.IsPublishableApp(oldVersion) {
    20  		t.Errorf("%s should not be publishable", oldVersion)
    21  	}
    22  	currentVersion := "ceci-nest-pas-une-app_v3.web.1"
    23  	if !s.IsPublishableApp(currentVersion) {
    24  		t.Errorf("%s should be publishable", currentVersion)
    25  	}
    26  	futureVersion := "ceci-nest-pas-une-app_v4.web.1"
    27  	if !s.IsPublishableApp(futureVersion) {
    28  		t.Errorf("%s should be publishable", futureVersion)
    29  	}
    30  }