timescaledb-docker-ha icon indicating copy to clipboard operation
timescaledb-docker-ha copied to clipboard

Error in GitHub actions when running the `timescaledb-ha:pg16` docker image in `testcontainers-go`

Open morris-kelly opened this issue 7 months ago • 4 comments

In the last few hours, I've started getting failing tests in GitHub actions with the following logs:

CREATE DATABASE
/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/000_install_timescaledb.sh
CREATE EXTENSION
CREATE EXTENSION
2024-07-02 14:40:46.537 UTC [58] ERROR:  TimescaleDB background worker connected to template database, exiting
2024-07-02 14:40:46.543 UTC [34] LOG:  background worker "TimescaleDB Background Worker Scheduler" (PID 58) exited with exit code 1
CREATE EXTENSION
/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/001_timescaledb_tune.sh
/docker-entrypoint-initdb.d/001_timescaledb_tune.sh: line 42: [: max: integer expression expected
Using postgresql.conf at this path:
/home/postgres/pgdata/data/postgresql.conf
Writing backup to:
/tmp/timescaledb_tune.backup202407021440
panic: bytes must be at least 1 byte (got 0)
goroutine 1 [running]:
github.com/timescale/timescaledb-tune/internal/parse.parseIntToFloatUnits(0xc0000b5c50?)
	/home/builder/go/pkg/mod/github.com/timescale/[email protected]/internal/parse/parse.go:115 +0x159
github.com/timescale/timescaledb-tune/internal/parse.BytesToDecimalFormat(0x0?)
	/home/builder/go/pkg/mod/github.com/timescale/[email protected]/internal/parse/parse.go:138 +0x1d
github.com/timescale/timescaledb-tune/pkg/tstune.(*Tuner).processQuiet(0xc0000b5f18, 0xc0000a1200, 0xc000282de0?)
	/home/builder/go/pkg/mod/github.com/timescale/[email protected]/pkg/tstune/tuner.go:[65](https://github.com/synaptecltd/synthesis/actions/runs/9763033277/job/26947904939#step:8:66)9 +0x66
github.com/timescale/timescaledb-tune/pkg/tstune.(*Tuner).Run(0xc0000b5f18, 0xc00005a000?, {0x530a28, 0xc00009a000}, {0x530a48, 0xc00009a008}, {0x530a48, 0xc00009a010})
	/home/builder/go/pkg/mod/github.com/timescale/[email protected]/pkg/tstune/tuner.go:300 +0x52c
main.main()
	/home/builder/go/pkg/mod/github.com/timescale/[email protected]/cmd/timescaledb-tune/main.go:65 +0x117

This can be reproduced by running this test in a CI pipeline

package main

import (
	"context"
	"testing"

	"github.com/testcontainers/testcontainers-go"
	"github.com/testcontainers/testcontainers-go/modules/postgres"
	"github.com/testcontainers/testcontainers-go/wait"
)

func TestTimescaleIntegration(t *testing.T) {
	dbUser := "postgres"
	dbPassword := "postgres"
	dbName := "postgres"

	_, err := postgres.RunContainer(context.TODO(),
		testcontainers.WithImage("timescale/timescaledb-ha:pg16"),
		postgres.WithDatabase(dbName),
		postgres.WithUsername(dbUser),
		postgres.WithPassword(dbPassword),
		testcontainers.WithWaitStrategy(
			wait.ForLog("database system is ready to accept connections").WithOccurrence(2)),
	)
	if err != nil {
		t.Fatal(err)
	}
}

I have had the exact same error with timescale/timescaledb-ha:pg15 and timescale/timescaledb-ha:pg16.3-ts2.15.2

Changing the image to testcontainers.WithImage("timescale/timescaledb:latest-pg16") enables the test to pass, which suggests that this is an issue with the -ha image.

Running with timescale/timescaledb-ha:pg16.3-ts2.15.1 pinned passes the tests also.

Running the failing images locally also works, this issue is only in GitHub actions.

morris-kelly avatar Jul 02 '24 15:07 morris-kelly