Skip to content

Commit 6c6aef2

Browse files
committed
try to fix integration_test.go and update clickhouse-go/v2
Signed-off-by: Slach <[email protected]>
1 parent 1976abe commit 6c6aef2

File tree

6 files changed

+31
-49
lines changed

6 files changed

+31
-49
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ jobs:
269269
GOROOT: ${{ env.GOROOT_1_23_X64 }}
270270
CLICKHOUSE_VERSION: ${{ matrix.clickhouse }}
271271
# options for advanced debug CI/CD
272-
RUN_TESTS: "^TestIntegrationGCS$"
273-
LOG_LEVEL: "debug"
272+
# RUN_TESTS: "^TestIntegrationGCS$"
273+
# LOG_LEVEL: "debug"
274274
# TEST_LOG_LEVEL: "debug"
275-
GCS_DEBUG: "true"
275+
# GCS_DEBUG: "true"
276276
# SFTP_DEBUG: "true"
277277
# AZBLOB_DEBUG: "true"
278278
# FTP_DEBUG: "true"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ debug
44
/clickhouse-backup
55
credentials.json
66
.idea
7+
*.iml
78
build/
89
.env
910
*.log

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0
1010
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2
1111
github.com/Azure/azure-storage-blob-go v0.15.0
12-
github.com/ClickHouse/clickhouse-go/v2 v2.32.0
12+
github.com/ClickHouse/clickhouse-go/v2 v2.32.2
1313
github.com/antchfx/xmlquery v1.4.4
1414
github.com/aws/aws-sdk-go-v2 v1.36.1
1515
github.com/aws/aws-sdk-go-v2/config v1.29.6
@@ -63,7 +63,7 @@ require (
6363
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
6464
github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect
6565
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.0 // indirect
66-
github.com/ClickHouse/ch-go v0.65.0 // indirect
66+
github.com/ClickHouse/ch-go v0.65.1 // indirect
6767
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect
6868
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.49.0 // indirect
6969
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.49.0 // indirect
@@ -148,7 +148,7 @@ require (
148148
golang.org/x/oauth2 v0.26.0 // indirect
149149
golang.org/x/sys v0.30.0 // indirect
150150
golang.org/x/time v0.10.0 // indirect
151-
google.golang.org/genproto v0.0.0-20250212204824-5a70512c5d8b // indirect
151+
google.golang.org/genproto v0.0.0-20250122153221-138b5a5a4fd4 // indirect
152152
google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b // indirect
153153
google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b // indirect
154154
google.golang.org/grpc v1.70.0 // indirect

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.4.0/go.mod h1:wP83
6868
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
6969
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
7070
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
71-
github.com/ClickHouse/ch-go v0.65.0 h1:vZAXfTQliuNNefqkPDewX3kgRxN6Q4vUENnnY+ynTRY=
72-
github.com/ClickHouse/ch-go v0.65.0/go.mod h1:tCM0XEH5oWngoi9Iu/8+tjPBo04I/FxNIffpdjtwx3k=
73-
github.com/ClickHouse/clickhouse-go/v2 v2.32.0 h1:zVWJUmUGdtCApM/vRfQhruGXIm1M643bk68B3IYbR1I=
74-
github.com/ClickHouse/clickhouse-go/v2 v2.32.0/go.mod h1:rGFIgeNbJVggBp2C+0FXOdfjsMlpsKx7FUYnHHyy2KE=
71+
github.com/ClickHouse/ch-go v0.65.1 h1:SLuxmLl5Mjj44/XbINsK2HFvzqup0s6rwKLFH347ZhU=
72+
github.com/ClickHouse/ch-go v0.65.1/go.mod h1:bsodgURwmrkvkBe5jw1qnGDgyITsYErfONKAHn05nv4=
73+
github.com/ClickHouse/clickhouse-go/v2 v2.32.2 h1:Y8fAXt0CpLhqNXMLlSddg+cMfAr7zHBWqXLpih6ozCY=
74+
github.com/ClickHouse/clickhouse-go/v2 v2.32.2/go.mod h1:/vE8N/+9pozLkIiTMWbNUGviccDv/czEGS1KACvpXIk=
7575
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 h1:3c8yed4lgqTt+oTQ+JNMDo+F4xprBf+O/il4ZC0nRLw=
7676
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0/go.mod h1:obipzmGjfSjam60XLwGfqUkJsfiheAl+TUjG+4yzyPM=
7777
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.49.0 h1:o90wcURuxekmXrtxmYWTyNla0+ZEHhud6DI1ZTxd1vI=
@@ -664,8 +664,8 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx
664664
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
665665
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
666666
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
667-
google.golang.org/genproto v0.0.0-20250212204824-5a70512c5d8b h1:TdBaFxGAABTI8sz9jYHPtjje677pS4XXup9vJMlj8hQ=
668-
google.golang.org/genproto v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:0TrvLFkilZy+XULmuoWfiTbTRXLWXJ1S44jQTW3lWwE=
667+
google.golang.org/genproto v0.0.0-20250122153221-138b5a5a4fd4 h1:Pw6WnI9W/LIdRxqK7T6XGugGbHIRl5Q7q3BssH6xk4s=
668+
google.golang.org/genproto v0.0.0-20250122153221-138b5a5a4fd4/go.mod h1:qbZzneIOXSq+KFAFut9krLfRLZiFLzZL5u2t8SV83EE=
669669
google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b h1:i+d0RZa8Hs2L/MuaOQYI+krthcxdEbEM2N+Tf3kJ4zk=
670670
google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4=
671671
google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b h1:FQtJ1MxbXoIIrZHZ33M+w5+dAP9o86rgpjoKr/ZmT7k=

test/integration/integration_test.go

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,7 @@ func TestCheckSystemPartsColumns(t *testing.T) {
20372037
env.Cleanup(t, r)
20382038
}
20392039

2040+
// // https://github.com/Altinity/clickhouse-backup/issues/871
20402041
func TestKeepBackupRemoteAndDiffFromRemote(t *testing.T) {
20412042
if isTestShouldSkip("RUN_ADVANCED_TESTS") {
20422043
t.Skip("Skipping Advanced integration tests...")
@@ -2056,27 +2057,37 @@ func TestKeepBackupRemoteAndDiffFromRemote(t *testing.T) {
20562057
for backupNumber, backupName := range backupNames {
20572058
if backupNumber == 0 {
20582059
env.DockerExecNoError(r, "clickhouse-backup", "bash", "-ce", fmt.Sprintf("BACKUPS_TO_KEEP_REMOTE=3 CLICKHOUSE_BACKUP_CONFIG=/etc/clickhouse-backup/config-s3.yml clickhouse-backup create_remote %s", backupName))
2060+
} else if backupNumber == 3 {
2061+
env.DockerExecNoError(r, "clickhouse-backup", "bash", "-ce", fmt.Sprintf("BACKUPS_TO_KEEP_REMOTE=3 CLICKHOUSE_BACKUP_CONFIG=/etc/clickhouse-backup/config-s3.yml clickhouse-backup create_remote --diff-from-remote=%s %s", backupNames[backupNumber-1], backupName))
20592062
} else {
20602063
incrementData = generateIncrementTestData(t, r, env, "S3", false, incrementData, backupNumber)
20612064
env.DockerExecNoError(r, "clickhouse-backup", "bash", "-ce", fmt.Sprintf("BACKUPS_TO_KEEP_REMOTE=3 CLICKHOUSE_BACKUP_CONFIG=/etc/clickhouse-backup/config-s3.yml clickhouse-backup create_remote --diff-from-remote=%s %s", backupNames[backupNumber-1], backupName))
20622065
}
20632066
}
20642067
out, err := env.DockerExecOut("clickhouse-backup", "bash", "-ce", "clickhouse-backup -c /etc/clickhouse-backup/config-s3.yml list local")
20652068
r.NoError(err, "%s\nunexpected list local error: %v", out, err)
2066-
// shall not delete any backup, cause all deleted backups have links as required in other backups
20672069
for _, backupName := range backupNames {
20682070
r.Contains(out, backupName)
20692071
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/config-s3.yml", "delete", "local", backupName)
20702072
}
2073+
out, err = env.DockerExecOut("clickhouse-backup", "bash", "-ce", "clickhouse-backup -c /etc/clickhouse-backup/config-s3.yml list remote")
2074+
r.NoError(err, "%s\nunexpected list remote error: %v", out, err)
2075+
// shall not delete any backup on remote, cause all deleted backups have links as required in other backups
2076+
for _, backupName := range backupNames {
2077+
r.Regexp("(?m)^"+backupName, out)
2078+
}
2079+
20712080
latestIncrementBackup := fmt.Sprintf("keep_remote_backup_%d", len(backupNames)-1)
20722081
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/config-s3.yml", "download", latestIncrementBackup)
20732082
out, err = env.DockerExecOut("clickhouse-backup", "bash", "-ce", "clickhouse-backup -c /etc/clickhouse-backup/config-s3.yml list local")
20742083
r.NoError(err, "%s\nunexpected list local error: %v", out, err)
20752084
prevIncrementBackup := fmt.Sprintf("keep_remote_backup_%d", len(backupNames)-2)
20762085
for _, backupName := range backupNames {
20772086
if backupName == latestIncrementBackup {
2078-
r.Contains(out, backupName)
2087+
r.Regexp("(?m)^"+backupName, out)
2088+
r.NotContains(out, "+"+backupName)
20792089
} else if backupName == prevIncrementBackup {
2090+
r.NotRegexp("(?m)^"+backupName, out)
20802091
r.Contains(out, "+"+backupName)
20812092
} else {
20822093
r.NotContains(out, backupName)
@@ -2085,7 +2096,8 @@ func TestKeepBackupRemoteAndDiffFromRemote(t *testing.T) {
20852096
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/config-s3.yml", "restore", "--rm", latestIncrementBackup)
20862097
var res uint64
20872098
r.NoError(env.ch.SelectSingleRowNoCtx(&res, fmt.Sprintf("SELECT count() FROM `%s_%s`.`%s_%s`", Issue331Issue1091Atomic, t.Name(), Issue331Issue1091Atomic, t.Name())))
2088-
r.Equal(uint64(100+20*4), res)
2099+
numBackupsWithData := 3
2100+
r.Equal(uint64(100+20*numBackupsWithData), res)
20892101
fullCleanup(t, r, env, []string{latestIncrementBackup}, []string{"local"}, nil, true, true, "config-s3.yml")
20902102
fullCleanup(t, r, env, backupNames, []string{"remote"}, databaseList, true, true, "config-s3.yml")
20912103
env.checkObjectStorageIsEmpty(t, r, "S3")
@@ -2626,7 +2638,6 @@ func (env *TestEnvironment) runMainIntegrationScenario(t *testing.T, remoteStora
26262638
// main test scenario
26272639
fullBackupName := fmt.Sprintf("%s_full_%d", t.Name(), rand.Int())
26282640
incrementBackupName := fmt.Sprintf("%s_increment_%d", t.Name(), rand.Int())
2629-
incrementBackupNameEmpty := fmt.Sprintf("%s_incrementEmpty_%d", t.Name(), rand.Int())
26302641
incrementBackupName2 := fmt.Sprintf("%s_increment2_%d", t.Name(), rand.Int())
26312642
databaseList := []string{dbNameOrdinary, dbNameAtomic, dbNameMySQL, dbNamePostgreSQL, Issue331Issue1091Atomic, Issue331Issue1091Ordinary}
26322643
tablesPattern := fmt.Sprintf("*_%s.*", t.Name())
@@ -2643,37 +2654,6 @@ func (env *TestEnvironment) runMainIntegrationScenario(t *testing.T, remoteStora
26432654
uploadCmd := fmt.Sprintf("%s_COMPRESSION_FORMAT=zstd CLICKHOUSE_BACKUP_CONFIG=/etc/clickhouse-backup/%s clickhouse-backup upload --resume %s", remoteStorageType, backupConfig, fullBackupName)
26442655
env.checkResumeAlreadyProcessed(uploadCmd, fullBackupName, "upload", r, remoteStorageType)
26452656

2646-
// https://github.com/Altinity/clickhouse-backup/issues/871
2647-
if !strings.Contains(remoteStorageType, "CUSTOM") {
2648-
log.Debug().Msg("Create+upload incrementEmpty without data")
2649-
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/"+backupConfig, "create", "--tables", tablesPattern, "--diff-from-remote", fullBackupName, incrementBackupNameEmpty)
2650-
out, err = env.DockerExecOut("clickhouse-backup", "bash", "-ec", "clickhouse-backup -c /etc/clickhouse-backup/"+backupConfig+" list local | grep "+incrementBackupNameEmpty)
2651-
r.NoError(err, out)
2652-
r.Contains(out, "+"+fullBackupName)
2653-
r.Contains(out, incrementBackupNameEmpty)
2654-
if !strings.Contains(remoteStorageType, "EMBEDDED") {
2655-
r.Contains(out, "data:0B")
2656-
} else {
2657-
r.Contains(out, "arch:0B")
2658-
}
2659-
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/"+backupConfig, "upload", "--env", "BACKUPS_TO_KEEP_REMOTE=2", "--env", "ALLOW_EMPTY_BACKUPS=1", "--diff-from-remote", fullBackupName, incrementBackupNameEmpty)
2660-
out, err = env.DockerExecOut("clickhouse-backup", "bash", "-ec", "clickhouse-backup -c /etc/clickhouse-backup/"+backupConfig+" list remote | grep '^"+fullBackupName+"'")
2661-
r.NoError(err, out)
2662-
r.Contains(out, fullBackupName)
2663-
r.NotContains(out, "data:0B")
2664-
out, err = env.DockerExecOut("clickhouse-backup", "bash", "-ec", "clickhouse-backup -c /etc/clickhouse-backup/"+backupConfig+" list remote | grep "+incrementBackupNameEmpty)
2665-
r.NoError(err, out)
2666-
r.Contains(out, "+"+fullBackupName)
2667-
r.Contains(out, incrementBackupNameEmpty)
2668-
if !strings.Contains(remoteStorageType, "EMBEDDED") {
2669-
r.Contains(out, "data:0B")
2670-
} else {
2671-
r.Contains(out, "arch:0B")
2672-
}
2673-
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/"+backupConfig, "delete", "remote", incrementBackupNameEmpty)
2674-
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/"+backupConfig, "delete", "local", incrementBackupNameEmpty)
2675-
}
2676-
26772657
log.Debug().Msg("Create increment1 with data")
26782658
incrementData := generateIncrementTestData(t, r, env, remoteStorageType, createAllTypesOfObjectTables, defaultIncrementData, 1)
26792659
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/"+backupConfig, "create", "--tables", tablesPattern, incrementBackupName)
@@ -3084,8 +3064,9 @@ func (env *TestEnvironment) checkResumeAlreadyProcessed(backupCmd, testBackupNam
30843064
r.NotContains(out, resumableWarning)
30853065
r.NotContains(out, resumableCleanup)
30863066
r.Contains(out, alreadyProcesses)
3067+
} else {
3068+
log.Debug().Msg(out)
30873069
}
3088-
log.Debug().Msg(out)
30893070
}
30903071

30913072
func fullCleanup(t *testing.T, r *require.Assertions, env *TestEnvironment, backupNames, backupTypes, databaseList []string, checkDeleteErr, checkDeleteOtherErr bool, backupConfig string) {

test/testflows/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
testflows==2.4.11
1+
testflows==2.4.19
22
requests
33
setuptools
44
PyYAML

0 commit comments

Comments
 (0)