Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
morris-kelly opened this issue Jul 2, 2024 · 4 comments

Comments

@morris-kelly
Copy link

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.

@devanubis
Copy link

We've also had this exact same issue today with our CI pipeline, which is using timescale/timescaledb-ha:pg14-all.

For now we've pinned to pg14.12-ts2.15.1-all.

@us77ipis
Copy link

us77ipis commented Jul 3, 2024

Same issue here with timescale/timescaledb-ha:pg16.

@holasoftware
Copy link

holasoftware commented Jul 4, 2024

It's working for me using the environment variable -e NO_TS_TUNE=true

docker run -d --name timescaledb -p 5433:5432 -e NO_TS_TUNE=true -e POSTGRES_PASSWORD=postgres timescale/timescaledb-ha:pg16

The issue is related to this script only docker-entrypoint-initdb.d/001_timescaledb_tune.sh

@us77ipis
Copy link

us77ipis commented Jul 4, 2024

For me it is working now again with timescale/timescaledb-ha:pg16 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants