Skip to content

Commit

Permalink
test*: fix error when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhl003 committed Apr 18, 2023
1 parent 2e76752 commit 2a87042
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ CHART_TOVERSION ?=3.0.0
TO_VERSION ?=v3.0.0
TAG ?=v3.0.0
IMGPREFIX ?=radondb/
MYSQL_IMAGE_57 ?=5.7.34
MYSQL_IMAGE_80 ?=8.0.25
MYSQL_IMAGE_57_TAG ?=$(IMGPREFIX)percona-server:$(MYSQL_IMAGE_57)
MYSQL_IMAGE_80_TAG ?=$(IMGPREFIX)percona-server:$(MYSQL_IMAGE_80)
IMG ?= $(IMGPREFIX)mysql-operator:$(TAG)
SIDECAR57_IMG ?= $(IMGPREFIX)mysql57-sidecar:$(TAG)
SIDECAR80_IMG ?= $(IMGPREFIX)mysql80-sidecar:$(TAG)
Expand Down Expand Up @@ -96,12 +92,6 @@ docker-build: ## Build docker image with the manager.
docker buildx build -f Dockerfile.sidecar --build-arg GO_PROXY=${GO_PORXY} -t ${SIDECAR57_IMG} .
docker buildx build -f build/xenon/Dockerfile --build-arg GO_PROXY=${GO_PORXY} -t ${XENON_IMG} .
docker buildx build --build-arg XTRABACKUP_PKG=percona-xtrabackup-80 --build-arg GO_PROXY=${GO_PORXY} -f Dockerfile.sidecar -t ${SIDECAR80_IMG} .
docker buildx build --build-arg "MYSQL_IMAGE=${MYSQL_IMAGE_57}" --build-arg GO_PROXY=${GO_PORXY} -f build/mysql/Dockerfile -t ${MYSQL_IMAGE_57_TAG} .
docker buildx build --build-arg "MYSQL_IMAGE=${MYSQL_IMAGE_80}" --build-arg GO_PROXY=${GO_PORXY} -f build/mysql/Dockerfile -t ${MYSQL_IMAGE_80_TAG} .
docker-build-mysql57: test ## Build docker image with the manager.
docker buildx build --build-arg "MYSQL_IMAGE=${MYSQL_IMAGE_57}" --build-arg GO_PROXY=${GO_PORXY} -f build/mysql/Dockerfile -t ${MYSQL_IMAGE_57_TAG} .
docker-build-mysql80:
docker buildx build --build-arg "MYSQL_IMAGE=${MYSQL_IMAGE_80}" --build-arg GO_PROXY=${GO_PORXY} -f build/mysql/Dockerfile -t ${MYSQL_IMAGE_80_TAG} .
docker-push: ## Push docker image with the manager.
docker push ${IMG}
docker push ${SIDECAR_IMG}
Expand Down
3 changes: 0 additions & 3 deletions charts/mysql-operator/crds/mysql.radondb.com_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,19 @@ spec:
type: string
type: object
method:
default: xtrabackup
description: BackupMethod represents the type of backup
type: string
schedule:
description: Backup Schedule
properties:
backupRetention:
default: 7
description: Backup Retention
format: int32
type: integer
cronExpression:
description: Cron expression for backup schedule
type: string
jobhistoryLimit:
default: 3
description: History Limit of job
format: int32
type: integer
Expand Down
3 changes: 0 additions & 3 deletions config/crd/bases/mysql.radondb.com_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,19 @@ spec:
type: string
type: object
method:
default: xtrabackup
description: BackupMethod represents the type of backup
type: string
schedule:
description: Backup Schedule
properties:
backupRetention:
default: 7
description: Backup Retention
format: int32
type: integer
cronExpression:
description: Cron expression for backup schedule
type: string
jobhistoryLimit:
default: 3
description: History Limit of job
format: int32
type: integer
Expand Down
8 changes: 6 additions & 2 deletions mysqlcluster/container/init_sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ var (
Name: utils.SysLocalTimeZone,
MountPath: utils.SysLocalTimeZoneMountPath,
},
{
Name: utils.MySQLcheckerVolumeName,
MountPath: utils.RadonDBBinDir,
},
}
initSidecarCase = EnsureContainer("init-sidecar", &testInitSidecarCluster)
)
Expand Down Expand Up @@ -445,7 +449,7 @@ func TestGetInitSidecarVolumeMounts(t *testing.T) {
MysqlCluster: &testToKuDBMysqlCluster,
}
tokudbCase := EnsureContainer("init-sidecar", &testTokuDBCluster)
tokuDBVolumeMounts := make([]corev1.VolumeMount, 8, 9)
tokuDBVolumeMounts := make([]corev1.VolumeMount, 9)
copy(tokuDBVolumeMounts, defaultInitsidecarVolumeMounts)
tokuDBVolumeMounts = append(tokuDBVolumeMounts, corev1.VolumeMount{
Name: utils.SysVolumeName,
Expand All @@ -461,7 +465,7 @@ func TestGetInitSidecarVolumeMounts(t *testing.T) {
MysqlCluster: &testPersistenceMysqlCluster,
}
persistenceCase := EnsureContainer("init-sidecar", &testPersistenceCluster)
persistenceVolumeMounts := make([]corev1.VolumeMount, 8, 9)
persistenceVolumeMounts := make([]corev1.VolumeMount, 9)
copy(persistenceVolumeMounts, defaultInitsidecarVolumeMounts)
persistenceVolumeMounts = append(persistenceVolumeMounts, corev1.VolumeMount{
Name: utils.DataVolumeName,
Expand Down
4 changes: 4 additions & 0 deletions mysqlcluster/container/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ func TestGetMysqlVolumeMounts(t *testing.T) {
Name: utils.SysLocalTimeZone,
MountPath: "/etc/localtime",
},
{
Name: utils.MySQLcheckerVolumeName,
MountPath: "/opt/radondb",
},
}
assert.Equal(t, volumeMounts, mysqlCase.VolumeMounts)
}
6 changes: 6 additions & 0 deletions mysqlcluster/mysqlcluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ func TestEnsureVolumes(t *testing.T) {
},
},
},
{
Name: utils.MySQLcheckerVolumeName,
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
}
// when disable Persistence
{
Expand Down
3 changes: 2 additions & 1 deletion sidecar/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ func runInitCommand(cfg *Config, hasInitialized bool) error {
buildSSLdata()
}
// copy mysqlchecker to /opt/radondb/
if exists, _ := checkIfPathExists(utils.TlsMountPath); exists {
if exists, _ := checkIfPathExists(utils.RadonDBBinDir); exists {
log.Info("copy mysqlchecker to /opt/radondb/")
copyMySQLchecker()
}

Expand Down

0 comments on commit 2a87042

Please sign in to comment.