Skip to content

Commit 3640771

Browse files
committed
Fix tests
1 parent 1e742c9 commit 3640771

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

.drone.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ workspace:
33
path: src/github.com/presslabs/mysql-operator
44

55
pipeline:
6+
build:
7+
image: golang:1.9
8+
environment:
9+
- APP_VERSION=${DRONE_BRANCH/master/latest}
10+
commands:
11+
- make full-test
12+
- make build
13+
- make install-docker
14+
when:
15+
event: push
16+
617
build:
718
image: golang:1.9
819
environment:
@@ -11,6 +22,8 @@ pipeline:
1122
- make full-test
1223
- make build
1324
- make install-docker
25+
when:
26+
event: tag
1427

1528
publish-operator:
1629
group: publish

pkg/mysqlcluster/cluster_test.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ func (f *cFactory) SyncHeadlessService() (string, error) {
4040
return f.syncHeadlessService()
4141
}
4242

43-
func (f *cFactory) SyncEnvSecret() (string, error) {
44-
return f.syncEnvSecret()
45-
}
46-
4743
func (f *cFactory) SyncConfigMapFiles() (string, error) {
4844
return f.syncConfigMysqlMap()
4945
}
@@ -108,8 +104,10 @@ func getFakeFactory(ns string, cluster *api.MysqlCluster, client *fake.Clientset
108104
}
109105

110106
rec := record.NewFakeRecorder(100)
107+
opt := newFakeOption()
111108

112109
return rec, &cFactory{
110+
opt: opt,
113111
cluster: cluster,
114112
client: client,
115113
myClient: myClient,
@@ -173,12 +171,6 @@ func TestSyncClusterCreationWithSecret(t *testing.T) {
173171
}
174172

175173
var err error
176-
_, err = client.CoreV1().Secrets(ns).Get(cluster.GetNameForResource(api.EnvSecret), metav1.GetOptions{})
177-
if err != nil {
178-
t.Fail()
179-
return
180-
}
181-
182174
_, err = client.CoreV1().ConfigMaps(ns).Get(cluster.GetNameForResource(api.ConfigMap), metav1.GetOptions{})
183175
if err != nil {
184176
t.Fail()

pkg/util/options/options.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ const (
6161
defaultExporterImage = "prom/mysqld-exporter:latest"
6262

6363
defaultImagePullPolicy = v1.PullIfNotPresent
64+
65+
defaultOrchestratorTopologyUser = ""
66+
defaultOrchestratorTopologyPassword = ""
6467
)
6568

6669
var (
@@ -79,9 +82,9 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
7982
"The secret name for used as pull secret.")
8083
fs.StringVar(&o.OrchestratorUri, "orchestrator-uri", "",
8184
"The orchestrator uri")
82-
fs.StringVar(&o.OrchestratorTopologyPassword, "orchestrator-topology-password", "",
85+
fs.StringVar(&o.OrchestratorTopologyPassword, "orchestrator-topology-password", defaultOrchestratorTopologyUser,
8386
"The orchestrator topology password. Can also be set as ORC_TOPOLOGY_PASSWORD environment variable.")
84-
fs.StringVar(&o.OrchestratorTopologyUser, "orchestrator-topology-user", "",
87+
fs.StringVar(&o.OrchestratorTopologyUser, "orchestrator-topology-user", defaultOrchestratorTopologyPassword,
8588
"The orchestrator topology user. Can also be set as ORC_TOPOLOGY_USER environment variable.")
8689
fs.DurationVar(&o.JobCompleteSuccessGraceTime, "job-grace-time", defaultJobGraceTime,
8790
"The time in hours how jobs after completion are keept.")
@@ -99,6 +102,9 @@ func GetOptions() *Options {
99102

100103
ImagePullPolicy: defaultImagePullPolicy,
101104
JobCompleteSuccessGraceTime: defaultJobGraceTime,
105+
106+
OrchestratorTopologyUser: "",
107+
OrchestratorTopologyPassword: "",
102108
}
103109
})
104110

0 commit comments

Comments
 (0)