Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
43a6876a
Commit
43a6876a
authored
Mar 23, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor manager/manager
parent
e1afffbc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
163 deletions
+116
-163
manager.go
cmd/manager/manager/manager.go
+69
-116
manager_test.go
cmd/manager/manager/manager_test.go
+45
-45
types.go
pkg/common/types.go
+2
-2
No files found.
cmd/manager/manager/manager.go
View file @
43a6876a
...
...
@@ -19,15 +19,13 @@ package manager
import
(
"fmt"
"log"
"net/url"
"regexp"
"strings"
"time"
"github.com/kubernetes/helm/cmd/manager/repository"
"github.com/kubernetes/helm/pkg/chart"
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/registry"
"github.com/kubernetes/helm/pkg/util"
"github.com/kubernetes/helm/pkg/repo"
)
// Manager manages a persistent set of Deployments.
...
...
@@ -44,26 +42,20 @@ type Manager interface {
GetManifest
(
deploymentName
string
,
manifest
string
)
(
*
common
.
Manifest
,
error
)
Expand
(
t
*
common
.
Template
)
(
*
common
.
Manifest
,
error
)
// Types
ListTypes
()
([]
string
,
error
)
ListInstances
(
typeName
string
)
([]
*
common
.
TypeInstance
,
error
)
GetRegistryForType
(
typeName
string
)
(
string
,
error
)
GetMetadataForType
(
typeName
string
)
(
string
,
error
)
// Charts
ListCharts
()
([]
string
,
error
)
ListChartInstances
(
chartName
string
)
([]
*
common
.
ChartInstance
,
error
)
GetRepoForChart
(
chartName
string
)
(
string
,
error
)
GetMetadataForChart
(
chartName
string
)
(
*
chart
.
Chartfile
,
error
)
GetChart
(
chartName
string
)
(
*
chart
.
Chart
,
error
)
// Registries
ListRegistries
()
([]
*
common
.
Registry
,
error
)
CreateRegistry
(
pr
*
common
.
Registry
)
error
GetRegistry
(
name
string
)
(
*
common
.
Registry
,
error
)
DeleteRegistry
(
name
string
)
error
// Registry Types
ListRegistryTypes
(
registryName
string
,
regex
*
regexp
.
Regexp
)
([]
registry
.
Type
,
error
)
GetDownloadURLs
(
registryName
string
,
t
registry
.
Type
)
([]
*
url
.
URL
,
error
)
GetFile
(
registryName
string
,
url
string
)
(
string
,
error
)
// Repo Charts
ListRepoCharts
(
repoName
string
,
regex
*
regexp
.
Regexp
)
([]
string
,
error
)
GetChartForRepo
(
repoName
,
chartName
string
)
(
*
chart
.
Chart
,
error
)
// Credentials
CreateCredential
(
name
string
,
c
*
common
.
Registry
Credential
)
error
GetCredential
(
name
string
)
(
*
common
.
Registry
Credential
,
error
)
CreateCredential
(
name
string
,
c
*
repo
.
Credential
)
error
GetCredential
(
name
string
)
(
*
repo
.
Credential
,
error
)
// Chart Repositories
ListChartRepos
()
([]
string
,
error
)
...
...
@@ -72,24 +64,23 @@ type Manager interface {
}
type
manager
struct
{
expander
Expander
deployer
Deployer
repository
repository
.
Repository
re
gistryProvider
registry
.
Registry
Provider
service
common
.
Registry
Service
expander
Expander
deployer
Deployer
repository
repository
.
Repository
re
poProvider
repo
.
IRepo
Provider
service
repo
.
IRepo
Service
//TODO: add chart repo service
credentialProvider
common
.
CredentialProvider
credentialProvider
repo
.
I
CredentialProvider
}
// NewManager returns a new initialized Manager.
func
NewManager
(
expander
Expander
,
deployer
Deployer
,
repository
repository
.
Repository
,
registryProvider
registry
.
RegistryProvider
,
service
common
.
RegistryService
,
//TODO: add chart repo service
credentialProvider
common
.
CredentialProvider
)
Manager
{
return
&
manager
{
expander
,
deployer
,
repository
,
registryProvider
,
service
,
credentialProvider
}
repoProvider
repo
.
IRepoProvider
,
service
repo
.
IRepoService
,
credentialProvider
repo
.
ICredentialProvider
)
Manager
{
return
&
manager
{
expander
,
deployer
,
repository
,
repoProvider
,
service
,
credentialProvider
}
}
// ListDeployments returns the list of deployments
...
...
@@ -190,7 +181,7 @@ func (m *manager) CreateDeployment(t *common.Template) (*common.Deployment, erro
}
// Finally update the type instances for this deployment.
m
.
set
Type
Instances
(
t
.
Name
,
manifest
.
Name
,
manifest
.
Layout
)
m
.
set
Chart
Instances
(
t
.
Name
,
manifest
.
Name
,
manifest
.
Layout
)
return
m
.
repository
.
GetValidDeployment
(
t
.
Name
)
}
...
...
@@ -210,20 +201,20 @@ func (m *manager) createManifest(t *common.Template) (*common.Manifest, error) {
},
nil
}
func
(
m
*
manager
)
set
Type
Instances
(
deploymentName
string
,
manifestName
string
,
layout
*
common
.
Layout
)
{
m
.
repository
.
Clear
Type
InstancesForDeployment
(
deploymentName
)
func
(
m
*
manager
)
set
Chart
Instances
(
deploymentName
string
,
manifestName
string
,
layout
*
common
.
Layout
)
{
m
.
repository
.
Clear
Chart
InstancesForDeployment
(
deploymentName
)
instances
:=
make
(
map
[
string
][]
*
common
.
Type
Instance
)
instances
:=
make
(
map
[
string
][]
*
common
.
Chart
Instance
)
for
i
,
r
:=
range
layout
.
Resources
{
add
Type
Instances
(
&
instances
,
r
,
deploymentName
,
manifestName
,
fmt
.
Sprintf
(
"$.resources[%d]"
,
i
))
add
Chart
Instances
(
&
instances
,
r
,
deploymentName
,
manifestName
,
fmt
.
Sprintf
(
"$.resources[%d]"
,
i
))
}
m
.
repository
.
Add
Type
Instances
(
instances
)
m
.
repository
.
Add
Chart
Instances
(
instances
)
}
func
add
TypeInstances
(
instances
*
map
[
string
][]
*
common
.
Type
Instance
,
r
*
common
.
LayoutResource
,
deploymentName
string
,
manifestName
string
,
jsonPath
string
)
{
func
add
ChartInstances
(
instances
*
map
[
string
][]
*
common
.
Chart
Instance
,
r
*
common
.
LayoutResource
,
deploymentName
string
,
manifestName
string
,
jsonPath
string
)
{
// Add this resource.
inst
:=
&
common
.
Type
Instance
{
inst
:=
&
common
.
Chart
Instance
{
Name
:
r
.
Name
,
Type
:
r
.
Type
,
Deployment
:
deploymentName
,
...
...
@@ -235,7 +226,7 @@ func addTypeInstances(instances *map[string][]*common.TypeInstance, r *common.La
// Add all sub resources if they exist.
for
i
,
sr
:=
range
r
.
Resources
{
add
Type
Instances
(
instances
,
sr
,
deploymentName
,
manifestName
,
fmt
.
Sprintf
(
"%s.resources[%d]"
,
jsonPath
,
i
))
add
Chart
Instances
(
instances
,
sr
,
deploymentName
,
manifestName
,
fmt
.
Sprintf
(
"%s.resources[%d]"
,
jsonPath
,
i
))
}
}
...
...
@@ -286,7 +277,7 @@ func (m *manager) DeleteDeployment(name string, forget bool) (*common.Deployment
}
// Finally remove the type instances for this deployment.
m
.
repository
.
Clear
Type
InstancesForDeployment
(
name
)
m
.
repository
.
Clear
Chart
InstancesForDeployment
(
name
)
return
d
,
nil
}
...
...
@@ -319,7 +310,7 @@ func (m *manager) PutDeployment(name string, t *common.Template) (*common.Deploy
}
// Finally update the type instances for this deployment.
m
.
set
Type
Instances
(
t
.
Name
,
manifest
.
Name
,
manifest
.
Layout
)
m
.
set
Chart
Instances
(
t
.
Name
,
manifest
.
Name
,
manifest
.
Layout
)
return
m
.
repository
.
GetValidDeployment
(
t
.
Name
)
}
...
...
@@ -336,59 +327,47 @@ func (m *manager) Expand(t *common.Template) (*common.Manifest, error) {
},
nil
}
func
(
m
*
manager
)
List
Type
s
()
([]
string
,
error
)
{
return
m
.
repository
.
List
Type
s
()
func
(
m
*
manager
)
List
Chart
s
()
([]
string
,
error
)
{
return
m
.
repository
.
List
Chart
s
()
}
func
(
m
*
manager
)
List
Instances
(
typeName
string
)
([]
*
common
.
Type
Instance
,
error
)
{
return
m
.
repository
.
Get
TypeInstances
(
type
Name
)
func
(
m
*
manager
)
List
ChartInstances
(
chartName
string
)
([]
*
common
.
Chart
Instance
,
error
)
{
return
m
.
repository
.
Get
ChartInstances
(
chart
Name
)
}
// GetRe
gistryForType returns the registry where a type
resides.
func
(
m
*
manager
)
GetRe
gistryForType
(
type
Name
string
)
(
string
,
error
)
{
_
,
r
,
err
:=
registry
.
GetDownloadURLs
(
m
.
registryProvider
,
type
Name
)
// GetRe
poForChart returns the repository where a chart
resides.
func
(
m
*
manager
)
GetRe
poForChart
(
chart
Name
string
)
(
string
,
error
)
{
_
,
r
,
err
:=
m
.
repoProvider
.
GetChartByReference
(
chart
Name
)
if
err
!=
nil
{
return
""
,
err
}
return
r
.
Get
Registry
Name
(),
nil
return
r
.
GetName
(),
nil
}
// GetMetadataFor
Type returns the metadata for type
.
func
(
m
*
manager
)
GetMetadataFor
Type
(
typeName
string
)
(
string
,
error
)
{
URLs
,
r
,
err
:=
registry
.
GetDownloadURLs
(
m
.
registryProvider
,
type
Name
)
// GetMetadataFor
Chart returns the metadata for a chart
.
func
(
m
*
manager
)
GetMetadataFor
Chart
(
chartName
string
)
(
*
chart
.
Chartfile
,
error
)
{
c
,
_
,
err
:=
m
.
repoProvider
.
GetChartByReference
(
chart
Name
)
if
err
!=
nil
{
return
""
,
err
}
if
len
(
URLs
)
<
1
{
return
""
,
nil
return
nil
,
err
}
// If it's a chart, we want the provenance file
fPath
:=
URLs
[
0
]
if
!
strings
.
Contains
(
fPath
,
".prov"
)
{
// It's not a chart, so we want the schema
fPath
+=
".schema"
}
return
c
.
Chartfile
(),
nil
}
metadata
,
err
:=
getFileFromRegistry
(
fPath
,
r
)
// GetChart returns a chart.
func
(
m
*
manager
)
GetChart
(
chartName
string
)
(
*
chart
.
Chart
,
error
)
{
c
,
_
,
err
:=
m
.
repoProvider
.
GetChartByReference
(
chartName
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"cannot get metadata for type (%s): %s"
,
typeName
,
err
)
return
nil
,
err
}
return
metadata
,
nil
}
// ListRegistries returns the list of registries
func
(
m
*
manager
)
ListRegistries
()
([]
*
common
.
Registry
,
error
)
{
return
m
.
service
.
List
()
return
c
,
nil
}
// ListChartRepos returns the list of chart repositories
func
(
m
*
manager
)
ListChartRepos
()
([]
string
,
error
)
{
//TODO: implement
return
nil
,
nil
return
m
.
service
.
List
()
}
// AddChartRepo adds a chart repository to list of available chart repositories
...
...
@@ -399,22 +378,17 @@ func (m *manager) AddChartRepo(name string) error {
// RemoveChartRepo removes a chart repository to list of available chart repositories
func
(
m
*
manager
)
RemoveChartRepo
(
name
string
)
error
{
//TODO: implement
return
nil
return
m
.
service
.
Delete
(
name
)
}
func
(
m
*
manager
)
CreateRe
gistry
(
pr
*
common
.
Registry
)
error
{
func
(
m
*
manager
)
CreateRe
po
(
pr
repo
.
IRepo
)
error
{
return
m
.
service
.
Create
(
pr
)
}
func
(
m
*
manager
)
GetRe
gistry
(
name
string
)
(
*
common
.
Registry
,
error
)
{
func
(
m
*
manager
)
GetRe
po
(
name
string
)
(
repo
.
IRepo
,
error
)
{
return
m
.
service
.
Get
(
name
)
}
func
(
m
*
manager
)
DeleteRegistry
(
name
string
)
error
{
return
m
.
service
.
Delete
(
name
)
}
func
generateManifestName
()
string
{
return
fmt
.
Sprintf
(
"manifest-%d"
,
time
.
Now
()
.
UTC
()
.
UnixNano
())
}
...
...
@@ -437,54 +411,33 @@ func getResourceErrors(c *common.Configuration) []string {
return
errs
}
// ListRe
gistryTypes lists types in a given registry whose string valu
es
// conform to the supplied regular expression, or all
type
s, if the regular
// ListRe
poCharts lists charts in a given repository whose nam
es
// conform to the supplied regular expression, or all
chart
s, if the regular
// expression is nil.
func
(
m
*
manager
)
ListRe
gistryTypes
(
registryName
string
,
regex
*
regexp
.
Regexp
)
([]
registry
.
Type
,
error
)
{
r
,
err
:=
m
.
re
gistryProvider
.
GetRegistryByName
(
registry
Name
)
func
(
m
*
manager
)
ListRe
poCharts
(
repoName
string
,
regex
*
regexp
.
Regexp
)
([]
string
,
error
)
{
r
,
err
:=
m
.
re
poProvider
.
GetRepoByName
(
repo
Name
)
if
err
!=
nil
{
return
nil
,
err
}
return
r
.
List
Type
s
(
regex
)
return
r
.
List
Chart
s
(
regex
)
}
// GetDownloadURLs returns the URLs required to download the contents
// of a given type in a given registry.
func
(
m
*
manager
)
GetDownloadURLs
(
registryName
string
,
t
registry
.
Type
)
([]
*
url
.
URL
,
error
)
{
r
,
err
:=
m
.
registryProvider
.
GetRegistryByName
(
registryName
)
// GetChartForRepo returns a chart from a given repository.
func
(
m
*
manager
)
GetChartForRepo
(
repoName
,
chartName
string
)
(
*
chart
.
Chart
,
error
)
{
r
,
err
:=
m
.
repoProvider
.
GetRepoByName
(
repoName
)
if
err
!=
nil
{
return
nil
,
err
}
return
r
.
GetDownloadURLs
(
t
)
}
// GetFile returns a file from the backing registry
func
(
m
*
manager
)
GetFile
(
registryName
string
,
url
string
)
(
string
,
error
)
{
r
,
err
:=
m
.
registryProvider
.
GetRegistryByName
(
registryName
)
if
err
!=
nil
{
return
""
,
err
}
return
getFileFromRegistry
(
url
,
r
)
}
func
getFileFromRegistry
(
url
string
,
r
registry
.
Registry
)
(
string
,
error
)
{
getter
:=
util
.
NewHTTPClient
(
3
,
r
,
util
.
NewSleeper
())
body
,
_
,
err
:=
getter
.
Get
(
url
)
if
err
!=
nil
{
return
""
,
err
}
return
body
,
nil
return
r
.
GetChart
(
chartName
)
}
// CreateCredential creates a credential that can be used to authenticate to re
gist
ry
func
(
m
*
manager
)
CreateCredential
(
name
string
,
c
*
common
.
Registry
Credential
)
error
{
// CreateCredential creates a credential that can be used to authenticate to re
posito
ry
func
(
m
*
manager
)
CreateCredential
(
name
string
,
c
*
repo
.
Credential
)
error
{
return
m
.
credentialProvider
.
SetCredential
(
name
,
c
)
}
func
(
m
*
manager
)
GetCredential
(
name
string
)
(
*
common
.
Registry
Credential
,
error
)
{
func
(
m
*
manager
)
GetCredential
(
name
string
)
(
*
repo
.
Credential
,
error
)
{
return
m
.
credentialProvider
.
GetCredential
(
name
)
}
cmd/manager/manager/manager_test.go
View file @
43a6876a
...
...
@@ -17,13 +17,13 @@ limitations under the License.
package
manager
import
(
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/repo"
"errors"
"reflect"
"strings"
"testing"
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/registry"
)
var
template
=
common
.
Template
{
Name
:
"test"
,
Content
:
"test"
}
...
...
@@ -128,17 +128,17 @@ func (deployer *deployerStub) PutConfiguration(configuration *common.Configurati
}
type
repositoryStub
struct
{
FailListDeployments
bool
Created
[]
string
ManifestAdd
map
[
string
]
*
common
.
Manifest
ManifestSet
map
[
string
]
*
common
.
Manifest
Deleted
[]
string
GetValid
[]
string
Type
Instances
map
[
string
][]
string
Type
InstancesCleared
bool
Get
Type
InstancesCalled
bool
ListTypesCalled
bool
DeploymentStates
[]
*
common
.
DeploymentState
FailListDeployments
bool
Created
[]
string
ManifestAdd
map
[
string
]
*
common
.
Manifest
ManifestSet
map
[
string
]
*
common
.
Manifest
Deleted
[]
string
GetValid
[]
string
Chart
Instances
map
[
string
][]
string
Chart
InstancesCleared
bool
Get
Chart
InstancesCalled
bool
ListTypesCalled
bool
DeploymentStates
[]
*
common
.
DeploymentState
}
func
(
repository
*
repositoryStub
)
reset
()
{
...
...
@@ -148,9 +148,9 @@ func (repository *repositoryStub) reset() {
repository
.
ManifestSet
=
make
(
map
[
string
]
*
common
.
Manifest
)
repository
.
Deleted
=
make
([]
string
,
0
)
repository
.
GetValid
=
make
([]
string
,
0
)
repository
.
Type
Instances
=
make
(
map
[
string
][]
string
)
repository
.
Type
InstancesCleared
=
false
repository
.
Get
Type
InstancesCalled
=
false
repository
.
Chart
Instances
=
make
(
map
[
string
][]
string
)
repository
.
Chart
InstancesCleared
=
false
repository
.
Get
Chart
InstancesCalled
=
false
repository
.
ListTypesCalled
=
false
repository
.
DeploymentStates
=
[]
*
common
.
DeploymentState
{}
}
...
...
@@ -233,26 +233,26 @@ func (repository *repositoryStub) GetLatestManifest(d string) (*common.Manifest,
}
// Types.
func
(
repository
*
repositoryStub
)
List
Type
s
()
([]
string
,
error
)
{
func
(
repository
*
repositoryStub
)
List
Chart
s
()
([]
string
,
error
)
{
repository
.
ListTypesCalled
=
true
return
[]
string
{},
nil
}
func
(
repository
*
repositoryStub
)
Get
TypeInstances
(
t
string
)
([]
*
common
.
Type
Instance
,
error
)
{
repository
.
Get
Type
InstancesCalled
=
true
return
[]
*
common
.
Type
Instance
{},
nil
func
(
repository
*
repositoryStub
)
Get
ChartInstances
(
t
string
)
([]
*
common
.
Chart
Instance
,
error
)
{
repository
.
Get
Chart
InstancesCalled
=
true
return
[]
*
common
.
Chart
Instance
{},
nil
}
func
(
repository
*
repositoryStub
)
Clear
Type
InstancesForDeployment
(
d
string
)
error
{
repository
.
Type
InstancesCleared
=
true
func
(
repository
*
repositoryStub
)
Clear
Chart
InstancesForDeployment
(
d
string
)
error
{
repository
.
Chart
InstancesCleared
=
true
return
nil
}
func
(
repository
*
repositoryStub
)
Add
TypeInstances
(
is
map
[
string
][]
*
common
.
Type
Instance
)
error
{
func
(
repository
*
repositoryStub
)
Add
ChartInstances
(
is
map
[
string
][]
*
common
.
Chart
Instance
)
error
{
for
t
,
instances
:=
range
is
{
for
_
,
instance
:=
range
instances
{
d
:=
instance
.
Deployment
repository
.
TypeInstances
[
d
]
=
append
(
repository
.
Type
Instances
[
d
],
t
)
repository
.
ChartInstances
[
d
]
=
append
(
repository
.
Chart
Instances
[
d
],
t
)
}
}
...
...
@@ -264,10 +264,10 @@ func (repository *repositoryStub) Close() {}
var
testExpander
=
&
expanderStub
{}
var
testRepository
=
newRepositoryStub
()
var
testDeployer
=
newDeployerStub
()
var
testRe
gistryService
=
registry
.
NewInmemRegistry
Service
()
var
testCredentialProvider
=
re
gistry
.
NewInmemCredentialProvider
()
var
testProvider
=
re
gistry
.
NewRegistryProvider
(
nil
,
registry
.
NewTestGithubRegistryProvider
(
""
,
nil
),
registry
.
NewTestGCSRegistryProvider
(
""
,
nil
),
testCredentialProvider
)
var
testManager
=
NewManager
(
testExpander
,
testDeployer
,
testRepository
,
testProvider
,
testRe
gistry
Service
,
testCredentialProvider
)
var
testRe
poService
=
repo
.
NewInmemRepo
Service
()
var
testCredentialProvider
=
re
po
.
NewInmemCredentialProvider
()
var
testProvider
=
re
po
.
NewRepoProvider
(
nil
,
repo
.
NewGCSRepoProvider
(
testCredentialProvider
),
testCredentialProvider
)
var
testManager
=
NewManager
(
testExpander
,
testDeployer
,
testRepository
,
testProvider
,
testRe
po
Service
,
testCredentialProvider
)
func
TestListDeployments
(
t
*
testing
.
T
)
{
testRepository
.
reset
()
...
...
@@ -363,12 +363,12 @@ func TestCreateDeployment(t *testing.T) {
t
.
Fatal
(
"CreateDeployment success did not mark deployment as deployed"
)
}
if
!
testRepository
.
Type
InstancesCleared
{
if
!
testRepository
.
Chart
InstancesCleared
{
t
.
Fatal
(
"Repository did not clear type instances during creation"
)
}
if
!
reflect
.
DeepEqual
(
testRepository
.
Type
Instances
,
typeInstMap
)
{
t
.
Fatalf
(
"Unexpected type instances after CreateDeployment: %s"
,
testRepository
.
Type
Instances
)
if
!
reflect
.
DeepEqual
(
testRepository
.
Chart
Instances
,
typeInstMap
)
{
t
.
Fatalf
(
"Unexpected type instances after CreateDeployment: %s"
,
testRepository
.
Chart
Instances
)
}
}
...
...
@@ -397,7 +397,7 @@ func TestCreateDeploymentCreationFailure(t *testing.T) {
"Received: %v, %s. Expected: %s, %s."
,
d
,
err
,
"nil"
,
errTest
)
}
if
testRepository
.
Type
InstancesCleared
{
if
testRepository
.
Chart
InstancesCleared
{
t
.
Fatal
(
"Unexpected change to type instances during CreateDeployment failure."
)
}
}
...
...
@@ -437,7 +437,7 @@ func TestCreateDeploymentCreationResourceFailure(t *testing.T) {
"Received: %v, %v. Expected: %v, %v."
,
d
,
err
,
&
deployment
,
"nil"
)
}
if
!
testRepository
.
Type
InstancesCleared
{
if
!
testRepository
.
Chart
InstancesCleared
{
t
.
Fatal
(
"Repository did not clear type instances during creation"
)
}
}
...
...
@@ -486,7 +486,7 @@ func TestDeleteDeploymentForget(t *testing.T) {
}
}
if
!
testRepository
.
Type
InstancesCleared
{
if
!
testRepository
.
Chart
InstancesCleared
{
t
.
Fatal
(
"Expected type instances to be cleared during DeleteDeployment."
)
}
}
...
...
@@ -521,29 +521,29 @@ func TestExpand(t *testing.T) {
func
TestListTypes
(
t
*
testing
.
T
)
{
testRepository
.
reset
()
testManager
.
List
Type
s
()
testManager
.
List
Chart
s
()
if
!
testRepository
.
ListTypesCalled
{
t
.
Fatal
(
"expected repository List
Type
s() call."
)
t
.
Fatal
(
"expected repository List
Chart
s() call."
)
}
}
func
TestListInstances
(
t
*
testing
.
T
)
{
testRepository
.
reset
()
testManager
.
ListInstances
(
"all"
)
testManager
.
List
Chart
Instances
(
"all"
)
if
!
testRepository
.
Get
Type
InstancesCalled
{
t
.
Fatal
(
"expected repository Get
Type
Instances() call."
)
if
!
testRepository
.
Get
Chart
InstancesCalled
{
t
.
Fatal
(
"expected repository Get
Chart
Instances() call."
)
}
}
// TODO(jackgr): Implement TestListRe
gistryType
s
func
TestListRe
gistryType
s
(
t
*
testing
.
T
)
{
// TODO(jackgr): Implement TestListRe
poChart
s
func
TestListRe
poChart
s
(
t
*
testing
.
T
)
{
/*
types, err := testManager.ListRe
gistryType
s("", nil)
types, err := testManager.ListRe
poChart
s("", nil)
if err != nil {
t.Fatalf("cannot list re
gist
ry types: %s", err)
t.Fatalf("cannot list re
posito
ry types: %s", err)
}
*/
}
...
...
@@ -551,7 +551,7 @@ func TestListRegistryTypes(t *testing.T) {
// TODO(jackgr): Implement TestGetDownloadURLs
func
TestGetDownloadURLs
(
t
*
testing
.
T
)
{
/*
urls, err := testManager.GetDownloadURLs("", re
gistry
.Type{})
urls, err := testManager.GetDownloadURLs("", re
po
.Type{})
if err != nil {
t.Fatalf("cannot list get download urls: %s", err)
}
...
...
pkg/common/types.go
View file @
43a6876a
...
...
@@ -170,9 +170,9 @@ type Resource struct {
State
*
ResourceState
`json:"state,omitempty"`
}
//
Type
Instance defines the metadata for an instantiation of a template type
//
Chart
Instance defines the metadata for an instantiation of a template type
// in a deployment.
type
Type
Instance
struct
{
type
Chart
Instance
struct
{
Name
string
`json:"name"`
// instance name
Type
string
`json:"type"`
// instance type
Deployment
string
`json:"deployment"`
// deployment name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment