style(*): gofmt

pull/291/head
Adam Reese 9 years ago
parent 8876c7e54b
commit 4134afee10

@ -275,7 +275,7 @@ func callService(path, method, action string, reader io.ReadCloser) {
panic(fmt.Errorf("cannot parse url (%s): %s\n", path, err)) panic(fmt.Errorf("cannot parse url (%s): %s\n", path, err))
} }
URL.Path = strings.TrimRight(URL.Path, "/") + "/" + strings.TrimLeft(path, "/") URL.Path = strings.TrimRight(URL.Path, "/") + "/" + strings.TrimLeft(path, "/")
resp := callHTTP(URL.String(), method, action, reader) resp := callHTTP(URL.String(), method, action, reader)
var j interface{} var j interface{}
if err := json.Unmarshal([]byte(resp), &j); err != nil { if err := json.Unmarshal([]byte(resp), &j); err != nil {

@ -6,7 +6,7 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@ -17,8 +17,8 @@ limitations under the License.
package service package service
import ( import (
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/cmd/expandybird/expander" "github.com/kubernetes/deployment-manager/cmd/expandybird/expander"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/pkg/util" "github.com/kubernetes/deployment-manager/pkg/util"
"errors" "errors"
@ -86,7 +86,7 @@ func NewExpansionHandler(backend expander.Expander) restful.RouteFunction {
} }
util.LogHandlerExit("expandybird", http.StatusOK, "OK", resp.ResponseWriter) util.LogHandlerExit("expandybird", http.StatusOK, "OK", resp.ResponseWriter)
message := fmt.Sprintf("\nConfig:\n%s\nLayout:\n%s\n", response.Config, response.Layout) message := fmt.Sprintf("\nConfig:\n%s\nLayout:\n%s\n", response.Config, response.Layout)
util.LogHandlerText("expandybird", message) util.LogHandlerText("expandybird", message)
resp.WriteEntity(response) resp.WriteEntity(response)
} }

@ -33,11 +33,11 @@ import (
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/cmd/manager/manager" "github.com/kubernetes/deployment-manager/cmd/manager/manager"
"github.com/kubernetes/deployment-manager/cmd/manager/repository" "github.com/kubernetes/deployment-manager/cmd/manager/repository"
"github.com/kubernetes/deployment-manager/cmd/manager/repository/persistent" "github.com/kubernetes/deployment-manager/cmd/manager/repository/persistent"
"github.com/kubernetes/deployment-manager/cmd/manager/repository/transient" "github.com/kubernetes/deployment-manager/cmd/manager/repository/transient"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/pkg/registry" "github.com/kubernetes/deployment-manager/pkg/registry"
"github.com/kubernetes/deployment-manager/pkg/util" "github.com/kubernetes/deployment-manager/pkg/util"
) )

@ -6,7 +6,7 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@ -6,7 +6,7 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,8 +26,8 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/kubernetes/deployment-manager/pkg/util"
"github.com/kubernetes/deployment-manager/pkg/common" "github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/pkg/util"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
) )

@ -6,7 +6,7 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,8 +26,8 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/kubernetes/deployment-manager/pkg/util"
"github.com/kubernetes/deployment-manager/pkg/common" "github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/pkg/util"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
) )
@ -64,15 +64,15 @@ resources:
`) `)
var validImportFilesTestCaseData = []*common.ImportFile{ var validImportFilesTestCaseData = []*common.ImportFile{
&common.ImportFile{ {
Name: "test-type.py", Name: "test-type.py",
Content: "test-type.py validTemplateTestCaseData content", Content: "test-type.py validTemplateTestCaseData content",
}, },
&common.ImportFile{ {
Name: "test.py", Name: "test.py",
Content: "test.py validTemplateTestCaseData content", Content: "test.py validTemplateTestCaseData content",
}, },
&common.ImportFile{ {
Name: "test2.py", Name: "test2.py",
Content: "test2.py validTemplateTestCaseData content", Content: "test2.py validTemplateTestCaseData content",
}, },

@ -24,8 +24,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/cmd/manager/repository" "github.com/kubernetes/deployment-manager/cmd/manager/repository"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/pkg/registry" "github.com/kubernetes/deployment-manager/pkg/registry"
"github.com/kubernetes/deployment-manager/pkg/util" "github.com/kubernetes/deployment-manager/pkg/util"
) )

@ -29,16 +29,16 @@ import (
var template = common.Template{Name: "test", Content: "test"} var template = common.Template{Name: "test", Content: "test"}
var layout = common.Layout{ var layout = common.Layout{
Resources: []*common.LayoutResource{&common.LayoutResource{Resource: common.Resource{Name: "test", Type: "test"}}}, Resources: []*common.LayoutResource{{Resource: common.Resource{Name: "test", Type: "test"}}},
} }
var configuration = common.Configuration{ var configuration = common.Configuration{
Resources: []*common.Resource{&common.Resource{Name: "test", Type: "test"}}, Resources: []*common.Resource{{Name: "test", Type: "test"}},
} }
var resourcesWithSuccessState = common.Configuration{ var resourcesWithSuccessState = common.Configuration{
Resources: []*common.Resource{&common.Resource{Name: "test", Type: "test", State: &common.ResourceState{Status: common.Created}}}, Resources: []*common.Resource{{Name: "test", Type: "test", State: &common.ResourceState{Status: common.Created}}},
} }
var resourcesWithFailureState = common.Configuration{ var resourcesWithFailureState = common.Configuration{
Resources: []*common.Resource{&common.Resource{ Resources: []*common.Resource{{
Name: "test", Name: "test",
Type: "test", Type: "test",
State: &common.ResourceState{ State: &common.ResourceState{
@ -64,7 +64,7 @@ var deployment = common.Deployment{
var deploymentList = []common.Deployment{deployment, {Name: "test2"}} var deploymentList = []common.Deployment{deployment, {Name: "test2"}}
var typeInstMap = map[string][]string{"test": []string{"test"}} var typeInstMap = map[string][]string{"test": {"test"}}
var errTest = errors.New("test error") var errTest = errors.New("test error")

@ -180,7 +180,7 @@ func (tr *typeResolver) ResolveTypes(config *common.Configuration, imports []*co
for _, u := range urls { for _, u := range urls {
if len(fetched[u]) == 0 { if len(fetched[u]) == 0 {
// If this import URL is new to us, add it to the URLs to fetch. // If this import URL is new to us, add it to the URLs to fetch.
toFetch = append(toFetch, &fetchUnit{[]fetchableURL{fetchableURL{urlRegistry, u}}}) toFetch = append(toFetch, &fetchUnit{[]fetchableURL{{urlRegistry, u}}})
} else { } else {
// If this is not a new import URL and we've already fetched its contents, // If this is not a new import URL and we've already fetched its contents,
// reuse them. Also, check if we also found a schema for that import URL and // reuse them. Also, check if we also found a schema for that import URL and

@ -118,7 +118,7 @@ resources:
` `
func TestIncludedImport(t *testing.T) { func TestIncludedImport(t *testing.T) {
imports := []*common.ImportFile{&common.ImportFile{Name: "foo.py"}} imports := []*common.ImportFile{{Name: "foo.py"}}
test := resolverTestCase{ test := resolverTestCase{
config: includeImport, config: includeImport,
imports: imports, imports: imports,
@ -133,11 +133,11 @@ resources:
` `
func TestSingleUrl(t *testing.T) { func TestSingleUrl(t *testing.T) {
finalImports := []*common.ImportFile{&common.ImportFile{Name: "http://my-fake-url", Path: "http://my-fake-url", Content: "my-content"}} finalImports := []*common.ImportFile{{Name: "http://my-fake-url", Path: "http://my-fake-url", Content: "my-content"}}
responses := map[string]responseAndError{ responses := map[string]responseAndError{
"http://my-fake-url": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url": {nil, http.StatusOK, "my-content"},
"http://my-fake-url.schema": responseAndError{nil, http.StatusNotFound, ""}, "http://my-fake-url.schema": {nil, http.StatusNotFound, ""},
} }
test := resolverTestCase{ test := resolverTestCase{
@ -151,7 +151,7 @@ func TestSingleUrl(t *testing.T) {
func TestSingleUrlWith500(t *testing.T) { func TestSingleUrlWith500(t *testing.T) {
responses := map[string]responseAndError{ responses := map[string]responseAndError{
"http://my-fake-url": responseAndError{nil, http.StatusInternalServerError, "my-content"}, "http://my-fake-url": {nil, http.StatusInternalServerError, "my-content"},
} }
test := resolverTestCase{ test := resolverTestCase{
@ -171,16 +171,16 @@ imports:
func TestSingleUrlWithSchema(t *testing.T) { func TestSingleUrlWithSchema(t *testing.T) {
finalImports := []*common.ImportFile{ finalImports := []*common.ImportFile{
&common.ImportFile{Name: "http://my-fake-url", Path: "http://my-fake-url", Content: "my-content"}, {Name: "http://my-fake-url", Path: "http://my-fake-url", Content: "my-content"},
&common.ImportFile{Name: "schema-import", Content: "schema-import"}, {Name: "schema-import", Content: "schema-import"},
&common.ImportFile{Name: "http://my-fake-url.schema", Content: schema1}, {Name: "http://my-fake-url.schema", Content: schema1},
} }
responses := map[string]responseAndError{ responses := map[string]responseAndError{
"http://my-fake-url": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url": {nil, http.StatusOK, "my-content"},
"http://my-fake-url.schema": responseAndError{nil, http.StatusOK, schema1}, "http://my-fake-url.schema": {nil, http.StatusOK, schema1},
"my-next-url": responseAndError{nil, http.StatusOK, "schema-import"}, "my-next-url": {nil, http.StatusOK, "schema-import"},
"my-next-url.schema": responseAndError{nil, http.StatusNotFound, ""}, "my-next-url.schema": {nil, http.StatusNotFound, ""},
} }
test := resolverTestCase{ test := resolverTestCase{
@ -210,18 +210,18 @@ resources:
func TestTooManyImports(t *testing.T) { func TestTooManyImports(t *testing.T) {
responses := map[string]responseAndError{ responses := map[string]responseAndError{
"http://my-fake-url": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url": {nil, http.StatusOK, "my-content"},
"http://my-fake-url.schema": responseAndError{nil, http.StatusNotFound, ""}, "http://my-fake-url.schema": {nil, http.StatusNotFound, ""},
"http://my-fake-url1": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url1": {nil, http.StatusOK, "my-content"},
"http://my-fake-url1.schema": responseAndError{nil, http.StatusNotFound, ""}, "http://my-fake-url1.schema": {nil, http.StatusNotFound, ""},
"http://my-fake-url2": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url2": {nil, http.StatusOK, "my-content"},
"http://my-fake-url2.schema": responseAndError{nil, http.StatusNotFound, ""}, "http://my-fake-url2.schema": {nil, http.StatusNotFound, ""},
"http://my-fake-url3": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url3": {nil, http.StatusOK, "my-content"},
"http://my-fake-url3.schema": responseAndError{nil, http.StatusNotFound, ""}, "http://my-fake-url3.schema": {nil, http.StatusNotFound, ""},
"http://my-fake-url4": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url4": {nil, http.StatusOK, "my-content"},
"http://my-fake-url4.schema": responseAndError{nil, http.StatusNotFound, ""}, "http://my-fake-url4.schema": {nil, http.StatusNotFound, ""},
"http://my-fake-url5": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url5": {nil, http.StatusOK, "my-content"},
"http://my-fake-url5.schema": responseAndError{nil, http.StatusNotFound, ""}, "http://my-fake-url5.schema": {nil, http.StatusNotFound, ""},
} }
test := resolverTestCase{ test := resolverTestCase{
@ -250,21 +250,21 @@ imports:
func TestSharedImport(t *testing.T) { func TestSharedImport(t *testing.T) {
finalImports := []*common.ImportFile{ finalImports := []*common.ImportFile{
&common.ImportFile{Name: "http://my-fake-url", Path: "http://my-fake-url", Content: "my-content"}, {Name: "http://my-fake-url", Path: "http://my-fake-url", Content: "my-content"},
&common.ImportFile{Name: "http://my-fake-url1", Path: "http://my-fake-url1", Content: "my-content-1"}, {Name: "http://my-fake-url1", Path: "http://my-fake-url1", Content: "my-content-1"},
&common.ImportFile{Name: "schema-import", Content: "schema-import"}, {Name: "schema-import", Content: "schema-import"},
&common.ImportFile{Name: "schema-import-1", Content: "schema-import"}, {Name: "schema-import-1", Content: "schema-import"},
&common.ImportFile{Name: "http://my-fake-url.schema", Content: schema1}, {Name: "http://my-fake-url.schema", Content: schema1},
&common.ImportFile{Name: "http://my-fake-url1.schema", Content: schema2}, {Name: "http://my-fake-url1.schema", Content: schema2},
} }
responses := map[string]responseAndError{ responses := map[string]responseAndError{
"http://my-fake-url": responseAndError{nil, http.StatusOK, "my-content"}, "http://my-fake-url": {nil, http.StatusOK, "my-content"},
"http://my-fake-url.schema": responseAndError{nil, http.StatusOK, schema1}, "http://my-fake-url.schema": {nil, http.StatusOK, schema1},
"http://my-fake-url1": responseAndError{nil, http.StatusOK, "my-content-1"}, "http://my-fake-url1": {nil, http.StatusOK, "my-content-1"},
"http://my-fake-url1.schema": responseAndError{nil, http.StatusOK, schema2}, "http://my-fake-url1.schema": {nil, http.StatusOK, schema2},
"my-next-url": responseAndError{nil, http.StatusOK, "schema-import"}, "my-next-url": {nil, http.StatusOK, "schema-import"},
"my-next-url.schema": responseAndError{nil, http.StatusNotFound, ""}, "my-next-url.schema": {nil, http.StatusNotFound, ""},
} }
test := resolverTestCase{ test := resolverTestCase{
@ -287,31 +287,31 @@ resources:
func TestShortGithubUrl(t *testing.T) { func TestShortGithubUrl(t *testing.T) {
finalImports := []*common.ImportFile{ finalImports := []*common.ImportFile{
&common.ImportFile{ {
Name: "github.com/kubernetes/application-dm-templates/common/replicatedservice:v1", Name: "github.com/kubernetes/application-dm-templates/common/replicatedservice:v1",
Path: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", Path: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py",
Content: "my-content"}, Content: "my-content"},
&common.ImportFile{ {
Name: "github.com/kubernetes/application-dm-templates/common/replicatedservice:v2", Name: "github.com/kubernetes/application-dm-templates/common/replicatedservice:v2",
Path: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py", Path: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py",
Content: "my-content-2"}, Content: "my-content-2"},
} }
downloadResponses := map[string]registry.DownloadResponse{ downloadResponses := map[string]registry.DownloadResponse{
"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py": registry.DownloadResponse{Err: nil, Code: http.StatusOK, Body: "my-content"}, "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py": {Err: nil, Code: http.StatusOK, Body: "my-content"},
"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py.schema": registry.DownloadResponse{Err: nil, Code: http.StatusNotFound, Body: ""}, "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py.schema": {Err: nil, Code: http.StatusNotFound, Body: ""},
"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py": registry.DownloadResponse{Err: nil, Code: http.StatusOK, Body: "my-content-2"}, "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py": {Err: nil, Code: http.StatusOK, Body: "my-content-2"},
"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py.schema": registry.DownloadResponse{Err: nil, Code: http.StatusNotFound, Body: ""}, "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py.schema": {Err: nil, Code: http.StatusNotFound, Body: ""},
} }
githubURLMaps := map[registry.Type]registry.TestURLAndError{ githubURLMaps := map[registry.Type]registry.TestURLAndError{
registry.NewTypeOrDie("common", "replicatedservice", "v1"): registry.TestURLAndError{URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", Err: nil}, registry.NewTypeOrDie("common", "replicatedservice", "v1"): {URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", Err: nil},
registry.NewTypeOrDie("common", "replicatedservice", "v2"): registry.TestURLAndError{URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py", Err: nil}, registry.NewTypeOrDie("common", "replicatedservice", "v2"): {URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py", Err: nil},
} }
gcsURLMaps := map[registry.Type]registry.TestURLAndError{ gcsURLMaps := map[registry.Type]registry.TestURLAndError{
registry.NewTypeOrDie("common", "replicatedservice", "v1"): registry.TestURLAndError{URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", Err: nil}, registry.NewTypeOrDie("common", "replicatedservice", "v1"): {URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", Err: nil},
registry.NewTypeOrDie("common", "replicatedservice", "v2"): registry.TestURLAndError{URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py", Err: nil}, registry.NewTypeOrDie("common", "replicatedservice", "v2"): {URL: "https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v2/replicatedservice.py", Err: nil},
} }
grp := registry.NewTestGithubRegistryProviderWithDownloads("github.com/kubernetes/application-dm-templates", githubURLMaps, downloadResponses) grp := registry.NewTestGithubRegistryProviderWithDownloads("github.com/kubernetes/application-dm-templates", githubURLMaps, downloadResponses)

@ -25,8 +25,8 @@ import (
"os" "os"
"time" "time"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/cmd/manager/repository" "github.com/kubernetes/deployment-manager/cmd/manager/repository"
"github.com/kubernetes/deployment-manager/pkg/common"
"gopkg.in/mgo.v2" "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson" "gopkg.in/mgo.v2/bson"

@ -213,8 +213,8 @@ func TestRepositoryDeleteDeploymentWorksForget(t *testing.T, r Repository) {
// TestRepositoryTypeInstances checks that type instances can be listed and retrieved successfully. // TestRepositoryTypeInstances checks that type instances can be listed and retrieved successfully.
func TestRepositoryTypeInstances(t *testing.T, r Repository) { func TestRepositoryTypeInstances(t *testing.T, r Repository) {
d1Map := map[string][]*common.TypeInstance{ d1Map := map[string][]*common.TypeInstance{
"t1": []*common.TypeInstance{ "t1": {
&common.TypeInstance{ {
Name: "i1", Name: "i1",
Type: "t1", Type: "t1",
Deployment: "d1", Deployment: "d1",
@ -225,8 +225,8 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
} }
d2Map := map[string][]*common.TypeInstance{ d2Map := map[string][]*common.TypeInstance{
"t2": []*common.TypeInstance{ "t2": {
&common.TypeInstance{ {
Name: "i2", Name: "i2",
Type: "t2", Type: "t2",
Deployment: "d2", Deployment: "d2",
@ -237,8 +237,8 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
} }
d3Map := map[string][]*common.TypeInstance{ d3Map := map[string][]*common.TypeInstance{
"t2": []*common.TypeInstance{ "t2": {
&common.TypeInstance{ {
Name: "i3", Name: "i3",
Type: "t2", Type: "t2",
Deployment: "d3", Deployment: "d3",

@ -23,8 +23,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/cmd/manager/repository" "github.com/kubernetes/deployment-manager/cmd/manager/repository"
"github.com/kubernetes/deployment-manager/pkg/common"
) )
// deploymentTypeInstanceMap stores type instances mapped by deployment name. // deploymentTypeInstanceMap stores type instances mapped by deployment name.

@ -17,8 +17,8 @@ limitations under the License.
package main package main
import ( import (
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/cmd/resourcifier/configurator" "github.com/kubernetes/deployment-manager/cmd/resourcifier/configurator"
"github.com/kubernetes/deployment-manager/pkg/common"
"github.com/kubernetes/deployment-manager/pkg/util" "github.com/kubernetes/deployment-manager/pkg/util"
"encoding/json" "encoding/json"

@ -6,7 +6,7 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@ -22,9 +22,9 @@ import (
func TestParse(t *testing.T) { func TestParse(t *testing.T) {
tests := map[string]Locator{ tests := map[string]Locator{
"helm:host/bucket/name#1.2.3": Locator{Scheme: "helm", Host: "host", Bucket: "bucket", Name: "name", Version: "1.2.3"}, "helm:host/bucket/name#1.2.3": {Scheme: "helm", Host: "host", Bucket: "bucket", Name: "name", Version: "1.2.3"},
"https://host/bucket/name-1.2.3.tgz": Locator{Scheme: "https", Host: "host", Bucket: "bucket", Name: "name", Version: "1.2.3"}, "https://host/bucket/name-1.2.3.tgz": {Scheme: "https", Host: "host", Bucket: "bucket", Name: "name", Version: "1.2.3"},
"http://host/bucket/name-1.2.3.tgz": Locator{Scheme: "http", Host: "host", Bucket: "bucket", Name: "name", Version: "1.2.3"}, "http://host/bucket/name-1.2.3.tgz": {Scheme: "http", Host: "host", Bucket: "bucket", Name: "name", Version: "1.2.3"},
} }
for start, expect := range tests { for start, expect := range tests {

@ -168,7 +168,7 @@ type githubRegistryProvider struct {
// NewGithubRegistryProvider creates a GithubRegistryProvider. // NewGithubRegistryProvider creates a GithubRegistryProvider.
func NewGithubRegistryProvider(cp common.CredentialProvider) GithubRegistryProvider { func NewGithubRegistryProvider(cp common.CredentialProvider) GithubRegistryProvider {
if cp == nil { if cp == nil {
// TODO: replace this panic with an error return. // TODO: replace this panic with an error return.
panic(fmt.Errorf("no credential provider")) panic(fmt.Errorf("no credential provider"))
} }
return &githubRegistryProvider{cp: cp} return &githubRegistryProvider{cp: cp}
@ -240,7 +240,7 @@ type gcsRegistryProvider struct {
// NewGCSRegistryProvider creates a GCSRegistryProvider. // NewGCSRegistryProvider creates a GCSRegistryProvider.
func NewGCSRegistryProvider(cp common.CredentialProvider) GCSRegistryProvider { func NewGCSRegistryProvider(cp common.CredentialProvider) GCSRegistryProvider {
if cp == nil { if cp == nil {
// TODO: replace this panic with an error return. // TODO: replace this panic with an error return.
panic(fmt.Errorf("no credential provider")) panic(fmt.Errorf("no credential provider"))
} }
return &gcsRegistryProvider{cp: cp} return &gcsRegistryProvider{cp: cp}

@ -36,13 +36,13 @@ func testURLConversionDriver(rp RegistryProvider, tests map[string]TestURLAndErr
func TestShortGithubURLTemplateMapping(t *testing.T) { func TestShortGithubURLTemplateMapping(t *testing.T) {
githubURLMaps := map[Type]TestURLAndError{ githubURLMaps := map[Type]TestURLAndError{
NewTypeOrDie("common", "replicatedservice", "v1"): TestURLAndError{"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", nil}, NewTypeOrDie("common", "replicatedservice", "v1"): {"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", nil},
NewTypeOrDie("storage", "redis", "v1"): TestURLAndError{"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/storage/redis/v1/redis.jinja", nil}, NewTypeOrDie("storage", "redis", "v1"): {"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/storage/redis/v1/redis.jinja", nil},
} }
tests := map[string]TestURLAndError{ tests := map[string]TestURLAndError{
"github.com/kubernetes/application-dm-templates/common/replicatedservice:v1": TestURLAndError{"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", nil}, "github.com/kubernetes/application-dm-templates/common/replicatedservice:v1": {"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/common/replicatedservice/v1/replicatedservice.py", nil},
"github.com/kubernetes/application-dm-templates/storage/redis:v1": TestURLAndError{"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/storage/redis/v1/redis.jinja", nil}, "github.com/kubernetes/application-dm-templates/storage/redis:v1": {"https://raw.githubusercontent.com/kubernetes/application-dm-templates/master/storage/redis/v1/redis.jinja", nil},
} }
grp := NewTestGithubRegistryProvider("github.com/kubernetes/application-dm-templates", githubURLMaps) grp := NewTestGithubRegistryProvider("github.com/kubernetes/application-dm-templates", githubURLMaps)
@ -52,13 +52,13 @@ func TestShortGithubURLTemplateMapping(t *testing.T) {
func TestShortGithubURLPackageMapping(t *testing.T) { func TestShortGithubURLPackageMapping(t *testing.T) {
githubURLMaps := map[Type]TestURLAndError{ githubURLMaps := map[Type]TestURLAndError{
NewTypeOrDie("", "mongodb", ""): TestURLAndError{"https://raw.githubusercontent.com/helm/charts/master/mongodb/manifests/mongodb.yaml", nil}, NewTypeOrDie("", "mongodb", ""): {"https://raw.githubusercontent.com/helm/charts/master/mongodb/manifests/mongodb.yaml", nil},
NewTypeOrDie("", "redis", ""): TestURLAndError{"https://raw.githubusercontent.com/helm/charts/master/redis/manifests/redis.yaml", nil}, NewTypeOrDie("", "redis", ""): {"https://raw.githubusercontent.com/helm/charts/master/redis/manifests/redis.yaml", nil},
} }
tests := map[string]TestURLAndError{ tests := map[string]TestURLAndError{
"github.com/helm/charts/mongodb": TestURLAndError{"https://raw.githubusercontent.com/helm/charts/master/mongodb/manifests/mongodb.yaml", nil}, "github.com/helm/charts/mongodb": {"https://raw.githubusercontent.com/helm/charts/master/mongodb/manifests/mongodb.yaml", nil},
"github.com/helm/charts/redis": TestURLAndError{"https://raw.githubusercontent.com/helm/charts/master/redis/manifests/redis.yaml", nil}, "github.com/helm/charts/redis": {"https://raw.githubusercontent.com/helm/charts/master/redis/manifests/redis.yaml", nil},
} }
grp := NewTestGithubRegistryProvider("github.com/helm/charts", githubURLMaps) grp := NewTestGithubRegistryProvider("github.com/helm/charts", githubURLMaps)

@ -6,7 +6,7 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@ -6,7 +6,7 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Loading…
Cancel
Save