Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Remove use-timescaledb option from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesGuthrie committed Sep 29, 2022
1 parent 76a7868 commit 5dc588f
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 178 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/go-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ jobs:
strategy:
matrix:
test-setups:
- {name: "Singlenode (14)", shortname: "singlenode-14", tsdb: true, multi: false, pg: 14}
- {name: "Singlenode (13)", shortname: "singlenode-13", tsdb: true, multi: false, pg: 13}
- {name: "Singlenode (12)", shortname: "singlenode-12", tsdb: true, multi: false, pg: 12}
- {name: "Singlenode (14)", shortname: "singlenode-14", multi: false, pg: 14}
- {name: "Singlenode (13)", shortname: "singlenode-13", multi: false, pg: 13}
- {name: "Singlenode (12)", shortname: "singlenode-12", multi: false, pg: 12}
# TODO (james): Skipping multinode because tests are broken for now
# - {name: "Multinode", shortname: "multinode", tsdb: true, multi: true, pg: 14}
# - {name: "Multinode", shortname: "multinode", multi: true, pg: 14}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand Down Expand Up @@ -115,10 +115,9 @@ jobs:
- name: Test ${{ matrix.test-setups.name }}
env:
DOCKER_IMAGE: ${{ needs.pick_docker_image.outputs[ format('docker_image_{0}', matrix.test-setups.pg) ] }}
TSDB: ${{ matrix.test-setups.tsdb }}
MULTI: ${{ matrix.test-setups.multi }}
SHORTNAME: ${{ matrix.test-setups.shortname }}
run: go test -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-timescaledb=$TSDB -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE
run: go test -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE

upgrade_test:
name: upgrade_tests
Expand Down
6 changes: 3 additions & 3 deletions pkg/tests/end_to_end_tests/config_dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestDatasetConfigApply(t *testing.T) {

pgxConn := conn.Conn()
require.Equal(t, 8*time.Hour, getMetricsDefaultChunkInterval(t, pgxConn))
require.Equal(t, *useTimescaleDB, getMetricsDefaultCompressionSetting(t, pgxConn))
require.Equal(t, true, getMetricsDefaultCompressionSetting(t, pgxConn))
require.Equal(t, 10*time.Second, getMetricsDefaultHALeaseRefresh(t, pgxConn))
require.Equal(t, 1*time.Minute, getMetricsDefaultHALeaseTimeout(t, pgxConn))
require.Equal(t, 90*24*time.Hour, getMetricsDefaultRetention(t, pgxConn))
Expand Down Expand Up @@ -50,14 +50,14 @@ func TestDatasetConfigApply(t *testing.T) {
require.Equal(t, 10*24*time.Hour, getTracesDefaultRetention(t, pgxConn))

// Set to default if chunk interval is not specified.
cfg, err = dataset.NewConfig("", *useTimescaleDB)
cfg, err = dataset.NewConfig("", true)
require.NoError(t, err)

err = cfg.Apply(pgxConn)
require.NoError(t, err)

require.Equal(t, 8*time.Hour, getMetricsDefaultChunkInterval(t, pgxConn))
require.Equal(t, *useTimescaleDB, getMetricsDefaultCompressionSetting(t, pgxConn))
require.Equal(t, true, getMetricsDefaultCompressionSetting(t, pgxConn))
require.Equal(t, 10*time.Second, getMetricsDefaultHALeaseRefresh(t, pgxConn))
require.Equal(t, 1*time.Minute, getMetricsDefaultHALeaseTimeout(t, pgxConn))
require.Equal(t, 90*24*time.Hour, getMetricsDefaultRetention(t, pgxConn))
Expand Down
9 changes: 0 additions & 9 deletions pkg/tests/end_to_end_tests/continuous_agg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ func TestContinuousAggDownsampling(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("continuous aggregates need TimescaleDB support")
}
if *useMultinode {
t.Skip("continuous aggregates not supported in multinode TimescaleDB setup")
}
Expand Down Expand Up @@ -334,9 +331,6 @@ func TestContinuousAggDataRetention(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("continuous aggregates need TimescaleDB support")
}
if *useMultinode {
t.Skip("continuous aggregates not supported in multinode TimescaleDB setup")
}
Expand Down Expand Up @@ -422,9 +416,6 @@ func TestContinuousAgg2StepAgg(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("continuous aggregates require TimescaleDB")
}
if *useMultinode {
t.Skip("continuous aggregates not supported in multinode TimescaleDB setup")
}
Expand Down
33 changes: 0 additions & 33 deletions pkg/tests/end_to_end_tests/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ func TestSQLChunkInterval(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("chunk intervals meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
db := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_admin")
defer db.Close()
Expand Down Expand Up @@ -503,9 +500,6 @@ func TestInsertCompressedDuplicates(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
db := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_writer")
defer db.Close()
Expand Down Expand Up @@ -621,9 +615,6 @@ func TestMetricBatcherLabelsBatching(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
db := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_writer")
defer db.Close()
Expand Down Expand Up @@ -691,9 +682,6 @@ func TestInsertCompressed(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
db := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_writer")
defer db.Close()
Expand Down Expand Up @@ -782,9 +770,6 @@ func TestInsertMultinodeAddNodes(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
if !*useMultinode {
t.Skip("Only applies for multinode")
}
Expand Down Expand Up @@ -877,9 +862,6 @@ func TestCompressionSetting(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
db := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_admin")
defer db.Close()
Expand Down Expand Up @@ -995,9 +977,6 @@ func TestCustomCompressionJob(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
dbJob := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_maintenance")
defer dbJob.Close()
Expand Down Expand Up @@ -1204,9 +1183,6 @@ func TestExecuteMaintenanceCompressionJob(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
dbJob := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_maintenance")
defer dbJob.Close()
Expand Down Expand Up @@ -1366,9 +1342,6 @@ func TestExecuteCompressionMetricsLocked(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("compression meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
dbJob := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_maintenance")
defer dbJob.Close()
Expand Down Expand Up @@ -1494,9 +1467,6 @@ func TestConfigMaintenanceJobs(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("jobs meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
db := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_admin")
defer db.Close()
Expand Down Expand Up @@ -1584,9 +1554,6 @@ func TestExecuteMaintJob(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("jobs meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
dbSuper, err := pgxpool.Connect(context.Background(), testhelpers.PgConnectURL(*testDatabase, testhelpers.Superuser))
if err != nil {
Expand Down
6 changes: 0 additions & 6 deletions pkg/tests/end_to_end_tests/database_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ import (
)

func TestDatabaseMetrics(t *testing.T) {
if !*useTimescaleDB {
t.Skip("test meaningless without TimescaleDB")
}
withDB(t, *testDatabase, func(dbOwner *pgxpool.Pool, t testing.TB) {
db := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_writer")
defer db.Close()
Expand Down Expand Up @@ -93,9 +90,6 @@ func TestDatabaseMetrics(t *testing.T) {
}

func TestDatabaseMetricsAfterCompression(t *testing.T) {
if !*useTimescaleDB {
t.Skip("test meaningless without TimescaleDB")
}
ts := generateSmallTimeseries()
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
ingestor, err := ingstr.NewPgxIngestorForTests(pgxconn.NewPgxConn(db), nil)
Expand Down
3 changes: 0 additions & 3 deletions pkg/tests/end_to_end_tests/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ func TestDeleteWithCompressedChunks(t *testing.T) {
if *useMultinode && !*extendedTest {
t.Skip("delete tests run in extended mode only for multi-node configuration")
}
if !*useTimescaleDB {
t.Skip("skipping delete tests with compression: compression tests cannot run if timescaledb is not installed.")
}
matchers := []deleteStr{
// Normal matchers.
{
Expand Down
22 changes: 4 additions & 18 deletions pkg/tests/end_to_end_tests/drop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ func TestSQLDropChunk(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("This test only runs on installs with TimescaleDB")
}
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
dbJob := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_maintenance")
defer dbJob.Close()
Expand Down Expand Up @@ -225,9 +222,6 @@ func TestSQLDropChunkWithLocked(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("This test only runs on installs with TimescaleDB")
}
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
dbJob := testhelpers.PgxPoolWithRole(t, *testDatabase, "prom_maintenance")
defer dbJob.Close()
Expand Down Expand Up @@ -331,9 +325,6 @@ func TestSQLDropDataWithoutTimescaleDB(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if *useTimescaleDB {
t.Skip("This test only runs on installs without TimescaleDB")
}
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
//a chunk way back in 2009
chunkEnds := time.Date(2009, time.November, 11, 0, 0, 0, 0, time.UTC)
Expand Down Expand Up @@ -416,9 +407,6 @@ func TestSQLDropMetricChunk(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
if !*useTimescaleDB {
t.Skip("This test only runs on installs with TimescaleDB")
}
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
scache := cache.NewSeriesCache(cache.DefaultConfig, nil)
//this is the range_end of a chunk boundary (exclusive)
Expand Down Expand Up @@ -721,12 +709,10 @@ func TestSQLDropAllMetricData(t *testing.T) {
t.Fatal(err)
}

if *useTimescaleDB {
//owner not admin since using timescale func to avoid randomness
_, err = dbOwner.Exec(context.Background(), "SELECT public.set_chunk_time_interval('prom_data.test', interval '8 hour')")
if err != nil {
t.Fatal(err)
}
//owner not admin since using timescale func to avoid randomness
_, err = dbOwner.Exec(context.Background(), "SELECT public.set_chunk_time_interval('prom_data.test', interval '8 hour')")
if err != nil {
t.Fatal(err)
}

ingestor, err := ingstr.NewPgxIngestorForTests(pgxconn.NewPgxConn(db), nil)
Expand Down
8 changes: 1 addition & 7 deletions pkg/tests/end_to_end_tests/golden_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
var outputDifferWithoutTimescale = map[string]bool{"info_view": true}
var outputDifferWithMultinode = map[string]bool{"views": true, "info_view": true}

var requiresTimescaleDB = map[string]bool{"views": true, "info_view": true, "support": true}
var requiresSingleNode = map[string]bool{"support": true}

func TestSQLGoldenFiles(t *testing.T) {
Expand All @@ -40,9 +39,6 @@ func TestSQLGoldenFiles(t *testing.T) {
base := filepath.Base(file)
base = strings.TrimSuffix(base, filepath.Ext(base))

if !*useTimescaleDB && requiresTimescaleDB[base] {
return
}
if *useMultinode && requiresSingleNode[base] {
return
}
Expand Down Expand Up @@ -81,10 +77,8 @@ func TestSQLGoldenFiles(t *testing.T) {
switch {
case outputDifferWithMultinode[base] && *useMultinode:
suffix = "-timescaledb-multinode"
case outputDifferWithoutTimescale[base] && *useTimescaleDB:
case outputDifferWithoutTimescale[base]:
suffix = "-timescaledb"
case outputDifferWithoutTimescale[base] && !*useTimescaleDB:
suffix = "-postgres"
default:
suffix = ""
}
Expand Down
20 changes: 0 additions & 20 deletions pkg/tests/end_to_end_tests/insert_compressed_chunks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,6 @@ import (

func TestInsertInCompressedChunks(t *testing.T) {
ts := generateSmallTimeseries()
if !*useTimescaleDB {
// Ingest in plain postgres to ensure everything works well even if TimescaleDB is not installed.
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) {
ingestor, err := ingstr.NewPgxIngestorForTests(pgxconn.NewPgxConn(db), nil)
require.NoError(t, err)
defer ingestor.Close()
_, _, err = ingestor.IngestMetrics(context.Background(), newWriteRequestWithTs(copyMetrics(ts)))
require.NoError(t, err)
r, err := db.Query(context.Background(), "SELECT * from prom_data.\"firstMetric\";")
require.NoError(t, err)
defer r.Close()

count := 0
for r.Next() {
count++
}
require.Equal(t, 5, count)
})
return
}

sample := []prompb.TimeSeries{
{
Expand Down
17 changes: 6 additions & 11 deletions pkg/tests/end_to_end_tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var (
testDatabase = flag.String("database", "tmp_db_timescale_migrate_test", "database to run integration tests on")
updateGoldenFiles = flag.Bool("update", false, "update the golden files of this test")
useDocker = flag.Bool("use-docker", true, "start database using a docker container")
useTimescaleDB = flag.Bool("use-timescaledb", true, "use TimescaleDB")
timescaleDockerImage = flag.String("timescale-docker-image", constants.PromscaleExtensionContainer, "TimescaleDB docker image to run tests against")
useMultinode = flag.Bool("use-multinode", false, "use TimescaleDB Multinode")
useTimescaleDBNightly = flag.Bool("use-timescaledb-nightly", false, "use TimescaleDB nightly images")
Expand Down Expand Up @@ -77,17 +76,14 @@ func init() {

// setExtensionState sets the value of testOptions based on the input flags.
func setExtensionState() {
if *useTimescaleDB {
testOptions.UseTimescaleDB()
}
testOptions.UseTimescaleDB()

if *useTimescaleDBNightly {
testOptions.UseTimescaleNightly()
}

if *useMultinode {
testOptions.UseMultinode()
*useTimescaleDB = true
}

testOptions.SetTimescaleDockerImage(*timescaleDockerImage)
Expand Down Expand Up @@ -240,12 +236,11 @@ func withDBAttachNode(t testing.TB, DBName string, attachExisting bool, beforeAd

func performMigrate(t testing.TB, connectURL string) {
extOptions := extension.ExtensionMigrateOptions{Install: true, Upgrade: true, UpgradePreRelease: true}
if *useTimescaleDB {
migrateURL := connectURL
err := extension.InstallUpgradeTimescaleDBExtensions(migrateURL, extOptions)
if err != nil {
t.Fatal(err)
}

migrateURL := connectURL
err := extension.InstallUpgradeTimescaleDBExtensions(migrateURL, extOptions)
if err != nil {
t.Fatal(err)
}

migratePool, err := pgxpool.Connect(context.Background(), connectURL)
Expand Down
Loading

0 comments on commit 5dc588f

Please sign in to comment.