Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: Compatibility Tests

on:
push:
branches: [unstable]
pull_request:
paths:
- '.github/workflows/compatibility.yml'
- 'src/storage/**'
- 'src/types/**'
- 'src/commands/**'
- 'src/config/**'
- 'tests/gocase/**'
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: Build current kvrocks image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6

# The old-version images are pulled from Docker Hub by the test; only
# the "new" side is built here, once, and handed to the parallel test
# jobs. Uses the same buildx method as the nightly image build; push
# defaults to false, so the image stays local.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd

- name: Build current kvrocks image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
load: true
tags: apache/kvrocks:current

- name: Save image
run: docker save apache/kvrocks:current | gzip > /tmp/kvrocks-current.tar.gz

- uses: actions/upload-artifact@v7
with:
name: kvrocks-current-image
path: /tmp/kvrocks-current.tar.gz
retention-days: 1

compatibility-test:
name: "${{ matrix.version }} -> current"
runs-on: ubuntu-22.04
needs: build
strategy:
fail-fast: false
matrix:
version: [v2.3.0, v2.6.0, v2.7.0, v2.10.0, v2.14.0, v2.15.0]
env:
KVROCKS_OLD_VERSION: ${{ matrix.version }}
# Test old-version data against the PR's own build, not the released
# :latest image, so an encoding regression in the change under test
# is caught.
KVROCKS_NEW_VERSION: current
steps:
- uses: actions/checkout@v6

- uses: actions/download-artifact@v8
with:
name: kvrocks-current-image
path: /tmp

- name: Load image
run: gunzip -c /tmp/kvrocks-current.tar.gz | docker load

- uses: actions/setup-go@v7
with:
go-version-file: 'tests/gocase/go.mod'
cache: false

# Pull the old-version image up front so the test does not race a lazy
# pull inside the container lifecycle.
- name: Pull old kvrocks image
run: docker pull docker.io/apache/kvrocks:${KVROCKS_OLD_VERSION#v}

# Each job runs on a fresh runner, so GOCACHE starts empty and the go
# test result cache cannot replay one version's result for another.
# KVROCKS_OLD_VERSION is read at runtime and is NOT part of the go test
# cache key, so if a shared cache is ever added (actions/cache on
# GOCACHE, or collapsing the matrix into a single looping job), version
# the cache key or pass -count=1 to go test.
- name: Run compatibility test
run: |
cd tests/gocase
go test -tags compat -run TestCompatibilityAllTypes ./integration/compatibility/
51 changes: 47 additions & 4 deletions tests/gocase/go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,70 @@
module github.com/apache/kvrocks/tests/gocase

go 1.25
go 1.25.0

require (
github.com/docker/docker v28.5.2+incompatible
github.com/redis/go-redis/v9 v9.17.2
github.com/shirou/gopsutil/v4 v4.25.12
github.com/shirou/gopsutil/v4 v4.26.2
github.com/stretchr/testify v1.11.1
github.com/testcontainers/testcontainers-go v0.41.0
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93
golang.org/x/sync v0.19.0
)

require (
dario.cat/mergo v1.0.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/ebitengine/purego v0.9.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.10.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.18.2 // indirect
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.2.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/tklauser/go-sysconf v0.3.16 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/sys v0.39.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/otel/sdk v1.42.0 // indirect
go.opentelemetry.io/otel/trace v1.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/sys v0.41.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading