Merge pull request #2077 from versity/ben/sidecar-test

test: add github actions functional tests for posix sidecar option
This commit is contained in:
Ben McClelland
2026-04-22 14:08:44 -07:00
committed by GitHub
5 changed files with 73 additions and 13 deletions

View File

@@ -0,0 +1,31 @@
name: functional tests (sidecar)
permissions: {}
on: pull_request
jobs:
build:
name: RunTests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 'stable'
id: go
- name: Get Dependencies
run: |
go mod download
- name: Build and Run
run: |
make testbin
./runtests.sh --sidecar
- name: Coverage Report
run: |
go tool covdata percent -i=/tmp/covdata

View File

@@ -100,5 +100,10 @@ up-app:
# Run the host-style tests in docker containers
.PHONY: test-host-style
test-host-style:
docker compose -f tests/host-style-tests/docker-compose.yml up --build --abort-on-container-exit --exit-code-from test
@compose_file=tests/host-style-tests/docker-compose.yml; \
COMPOSE_MENU=false docker compose -f "$$compose_file" down -v --remove-orphans >/dev/null 2>&1 || true; \
COMPOSE_MENU=false docker compose -f "$$compose_file" up --build --abort-on-container-exit --exit-code-from test; \
status=$$?; \
COMPOSE_MENU=false docker compose -f "$$compose_file" down -v --remove-orphans; \
exit $$status

View File

@@ -1,5 +1,21 @@
#!/bin/bash
# parse options
USE_SIDECAR=false
for arg in "$@"; do
case "$arg" in
--sidecar) USE_SIDECAR=true ;;
esac
done
# build sidecar flag for versitygw invocations
SIDECAR_FLAG=""
if $USE_SIDECAR; then
rm -rf /tmp/sidecar
mkdir /tmp/sidecar
SIDECAR_FLAG="--sidecar /tmp/sidecar"
fi
# make temp dirs
rm -rf /tmp/gw
mkdir /tmp/gw
@@ -26,7 +42,7 @@ openssl req -new -x509 -key key.pem -out cert.pem -days 365 -subj "/C=US/ST=Cali
ECHO "Running the sdk test over http"
# run server in background not versioning-enabled
# port: 7070(default)
GOCOVERDIR=/tmp/covdata ./versitygw -a user -s pass --iam-dir /tmp/gw posix /tmp/gw &
GOCOVERDIR=/tmp/covdata ./versitygw -a user -s pass --iam-dir /tmp/gw posix $SIDECAR_FLAG /tmp/gw &
GW_PID=$!
sleep 1
@@ -63,7 +79,7 @@ ECHO "Running the sdk test over https"
# run server in background with TLS certificate
# port: 7071(default)
GOCOVERDIR=/tmp/https.covdata ./versitygw --cert "$PWD/cert.pem" --key "$PWD/key.pem" -p :7071 -a user -s pass --iam-dir /tmp/gw posix /tmp/gw &
GOCOVERDIR=/tmp/https.covdata ./versitygw --cert "$PWD/cert.pem" --key "$PWD/key.pem" -p :7071 -a user -s pass --iam-dir /tmp/gw posix $SIDECAR_FLAG /tmp/gw &
GW_HTTPS_PID=$!
sleep 1
@@ -99,7 +115,7 @@ kill $GW_HTTPS_PID
ECHO "Running the sdk test over http against the versioning-enabled gateway"
# run server in background versioning-enabled
# port: 7072
GOCOVERDIR=/tmp/versioning.covdata ./versitygw -p :7072 -a user -s pass --iam-dir /tmp/gw posix --versioning-dir /tmp/versioningdir /tmp/gw &
GOCOVERDIR=/tmp/versioning.covdata ./versitygw -p :7072 -a user -s pass --iam-dir /tmp/gw posix $SIDECAR_FLAG --versioning-dir /tmp/versioningdir /tmp/gw &
GW_VS_PID=$!
# wait a second for server to start up
@@ -131,7 +147,7 @@ kill $GW_VS_PID
ECHO "Running the sdk test over https against the versioning-enabled gateway"
# run server in background versioning-enabled
# port: 7073
GOCOVERDIR=/tmp/versioning.https.covdata ./versitygw --cert "$PWD/cert.pem" --key "$PWD/key.pem" -p :7073 -a user -s pass --iam-dir /tmp/gw posix --versioning-dir /tmp/versioningdir /tmp/gw &
GOCOVERDIR=/tmp/versioning.https.covdata ./versitygw --cert "$PWD/cert.pem" --key "$PWD/key.pem" -p :7073 -a user -s pass --iam-dir /tmp/gw posix $SIDECAR_FLAG --versioning-dir /tmp/versioningdir /tmp/gw &
GW_VS_HTTPS_PID=$!
# wait a second for server to start up
@@ -163,7 +179,7 @@ kill $GW_VS_HTTPS_PID
ECHO "Running No ACL integration tests"
# run server in background versioning-enabled
# port: 7073
GOCOVERDIR=/tmp/noacl.covdata ./versitygw -p :7074 -a user -s pass -noacl --iam-dir /tmp/gw posix /tmp/gw &
GOCOVERDIR=/tmp/noacl.covdata ./versitygw -p :7074 -a user -s pass -noacl --iam-dir /tmp/gw posix $SIDECAR_FLAG /tmp/gw &
GW_NO_ACL_PID=$!
# wait a second for server to start up

View File

@@ -37,8 +37,12 @@ func NewTestState(ctx context.Context, conf *S3Conf, parallel bool) *TestState {
parallel: parallel,
}
// Start background test processor (only used in parallel mode)
go ts.process()
// Start background test processor (only used in parallel mode).
// Track it in the WaitGroup so Wait() doesn't return until process()
// has drained mainCh and all launched goroutines have finished.
ts.wg.Go(func() {
ts.process()
})
return ts
}
@@ -99,9 +103,12 @@ func (ct *TestState) process() {
// Wait blocks until all queued parallel tests complete, then runs all
// synchronous tests. It also ensures proper cleanup of the test channel.
func (ct *TestState) Wait() {
// Wait for all parallel tests to finish
ct.wg.Wait()
// Close the channel first so process() drains remaining items and exits.
// This must happen before wg.Wait() to avoid a race where wg.Wait()
// returns while process() still has buffered tests yet to start.
close(ct.mainCh)
// Wait for process() goroutine and all test goroutines to finish.
ct.wg.Wait()
// Run all synchronous tests sequentially
for _, fn := range ct.syncTests {

View File

@@ -127,9 +127,10 @@ func teardown(s *S3Conf, bucket string) error {
for attempts < maxRetryAttempts {
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
_, err = s3client.DeleteObject(ctx, &s3.DeleteObjectInput{
Bucket: bucket,
Key: key,
VersionId: versionId,
Bucket: bucket,
Key: key,
VersionId: versionId,
BypassGovernanceRetention: aws.Bool(true),
})
cancel()
if err == nil {