fix ut test

Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
runzexia
2020-03-27 11:19:37 +08:00
parent f411bec10b
commit 2fce04efd3
4 changed files with 268 additions and 7 deletions

View File

@@ -2,7 +2,6 @@ package devops
import (
v1 "k8s.io/api/core/v1"
"time"
)
type Credential struct {
@@ -24,12 +23,6 @@ type Credential struct {
} `json:"fingerprint,omitempty" description:"usage of the Credential"`
Description string `json:"description,omitempty" description:"Credential's description'"`
Domain string `json:"domain,omitempty" description:"Credential's domain,In ks we only use the default domain, default '_''"`
CreateTime *time.Time `json:"create_time,omitempty" description:"Credential's create_time'"`
Creator string `json:"creator,omitempty" description:"Creator's username"`
UsernamePasswordCredential *UsernamePasswordCredential `json:"username_password,omitempty" description:"username password Credential struct"`
SshCredential *SshCredential `json:"ssh,omitempty" description:"ssh Credential struct"`
SecretTextCredential *SecretTextCredential `json:"secret_text,omitempty" description:"secret_text Credential struct"`
KubeconfigCredential *KubeconfigCredential `json:"kubeconfig,omitempty" description:"kubeconfig Credential struct"`
}
type UsernamePasswordCredential struct {

View File

@@ -27,6 +27,7 @@ func New(projects ...string) *Devops {
Data: nil,
Projects: map[string]interface{}{},
Pipelines: map[string]map[string]*devopsv1alpha3.Pipeline{},
Credentials: map[string]map[string]*v1.Secret{},
}
for _, p := range projects {
d.Projects[p] = true
@@ -38,6 +39,7 @@ func NewWithPipelines(project string, pipelines ...*devopsv1alpha3.Pipeline) *De
Data: nil,
Projects: map[string]interface{}{},
Pipelines: map[string]map[string]*devopsv1alpha3.Pipeline{},
Credentials: map[string]map[string]*v1.Secret{},
}
d.Projects[project] = true