Skip to content

Commit

Permalink
Switch default versions
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Apr 29, 2015
1 parent f1f14c9 commit 0767b79
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pkg/api/latest/latest.go
Expand Up @@ -16,7 +16,7 @@ import (
)

// Version is the string that represents the current external default version.
const Version = "v1beta1"
const Version = "v1beta3"

// OldestVersion is the string that represents the oldest server version supported,
// for client code that wants to hardcode the lowest common denominator.
Expand Down Expand Up @@ -120,8 +120,8 @@ func init() {
},
)

// list of versions we support on the server
versions := Versions
// list of versions we support on the server, in preferred order
versions := []string{"v1beta3", "v1beta1"}

// versions that used mixed case URL formats
versionMixedCase := map[string]bool{
Expand Down
24 changes: 18 additions & 6 deletions test/templates/templates_test.go
Expand Up @@ -6,6 +6,7 @@ import (
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"

kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
Expand All @@ -17,7 +18,8 @@ import (

"github.com/openshift/origin/pkg/api/latest"
osclient "github.com/openshift/origin/pkg/client"
config "github.com/openshift/origin/pkg/config/api"
//config "github.com/openshift/origin/pkg/config/api"
templateapi "github.com/openshift/origin/pkg/template/api"
templateregistry "github.com/openshift/origin/pkg/template/registry"
)

Expand Down Expand Up @@ -52,18 +54,24 @@ func TestTemplateTransformationFromConfig(t *testing.T) {
server := httptest.NewServer(osMux)
defer server.Close()

osClient := osclient.NewOrDie(&kclient.Config{Host: server.URL})
osClient := osclient.NewOrDie(&kclient.Config{Host: server.URL, Version: latest.Version})

storage := map[string]rest.Storage{
"templateConfigs": templateregistry.NewREST(true),
"processedTemplates": templateregistry.NewREST(false),
}
if !kapi.PreV1Beta3(latest.Version) {
for k, v := range storage {
delete(storage, k)
storage[strings.ToLower(k)] = v
}
}

interfaces, _ := latest.InterfacesFor(latest.Version)
handlerContainer := master.NewHandlerContainer(osMux)
version := apiserver.APIGroupVersion{
Root: "/osapi",
Version: "v1beta1",
Version: latest.Version,

Mapper: latest.RESTMapper,

Expand All @@ -82,9 +90,13 @@ func TestTemplateTransformationFromConfig(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}

walkJSONFiles("fixtures", func(name, path string, _ []byte) {
config := &config.Config{}
err := osClient.RESTClient.Post().Resource("templateConfigs").Body(path).Do().Into(config)
walkJSONFiles("fixtures", func(name, path string, data []byte) {
template, err := interfaces.Codec.Decode(data)
if err != nil {
t.Errorf("%q: unexpected error: %v", path, err)
return
}
config, err := osClient.TemplateConfigs("default").Create(template.(*templateapi.Template))
if err != nil {
t.Errorf("%q: unexpected error: %v", path, err)
return
Expand Down

0 comments on commit 0767b79

Please sign in to comment.