Skip to content

Latest commit

 

History

History
119 lines (86 loc) · 3.77 KB

DEVELOP.md

File metadata and controls

119 lines (86 loc) · 3.77 KB

How to develop MOCO

Running tests

MOCO has the following 4 kinds of tests:

  1. Tests that do not depend on MySQL or Kubernetes
  2. pkg/dbop and pkg/bkop tests that depend on MySQL version
  3. Tests that depend on Kubernetes and therefore run by controller-runtime's envtest
  4. End-to-end tests

To run these tests, use the following make targets respectively:

  1. make test
  2. make test-dbop test-bkop
  3. make envtest
  4. Read e2e/README.md

Generated files

Some files in the repository are auto-generated.

  • docs/crd_*.md are generated by make apidoc.
  • Some files under config are generated by make manifests.
  • api/**/*.deepcopy.go are generated by make generate.

CI checks and fails if they need to be rebuilt.

Testing with unreleased moco-agent

MOCO depends on moco-agent that is released from a different repository. The dependency is therefore managed in go.mod file.

To run e2e tests with an unreleased moco-agent, follow the instructions in e2e/README.md.

In case you need to use the new API set of unreleased moco-agent, use replace directive in go.mod to reference the local source code.

Updating MySQL binaries in moco-backup

Edit the following lines in Dockerfile:

# The tag should be the latest one
FROM ghcr.io/cybozu-go/moco/mysql:8.4.3.1 as mysql

# See the below description for how to get the version string.
ARG MYSQLSH_VERSION=8.4.3-1

The MySQL shell debian package can be found in https://dev.mysql.com/downloads/shell/ .

  1. Choose "Ubuntu Linux"
  2. Choose mysql-shell_*ubuntu*_amd64.deb (not a dbgsym image) and click "Download" button.
  3. Copy the URL from the link whose text reads No thanks, just start my download..
  4. Update MYSQLSH_VERSION in Dockerfile.

Updating tools used for tests

Edit Makefile and e2e/Makefile. Tool versions are defined at the top of them.

Adding or dropping supported software versions

Edit matrix strategies in .github/workflows/ci.yaml. Also, don't forget to update README.md.

MySQL versions appear twice:

  dbtest:
    name: Integration tests with MySQL
    strategy:
      matrix:
        mysql-version: ["8.0.28", "8.0.37", "8.0.39", "8.0.40", "8.4.3"]
...
  # Matrix tests for the latest MySQL version on different Kubernetes versions.
  e2e:
    name: Supported Kubernetes versions End-to-End Tests
    strategy:
      matrix:
        mysql-version: ["8.4.3"]
        k8s-version: ["1.29.4", "1.30.4", "1.31.0"]
...
  # Matrix tests for different MySQL versions on the latest supported Kubernetes version.
  e2e-mysql:
    name: Supported MySQL versions End-to-End Tests
    strategy:
      matrix:
        mysql-version: ["8.0.28", "8.0.37", "8.0.39", "8.0.40", "8.4.3"]
        k8s-version: ["1.31.0"]

Updating moco-agent

Run go get github.com/cybozu-go/moco-agent@latest.

Updating fluent-bit

Edit FluentBitImage in version.go.

Updating mysqld_exporter

Edit ExporterImage in version.go.