Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,17 @@ updates:
directory: "/images/svc-base/"
schedule:
interval: "weekly"

- package-ecosystem: "docker"
directories:
- /env/default
schedule:
interval: "weekly"
ignore:
- dependency-name: "clickhouse/clickhouse-server"
groups:
workbench:
patterns:
- "*"
update-types:
- patch
40 changes: 23 additions & 17 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,34 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Start Workbench
uses: scality/workbench@v0.8.0

- name: Start ClickHouse
run: docker compose up -d

- name: Wait for ClickHouse to be ready
run: |
timeout 30 bash -c 'until docker compose exec -T clickhouse-shard-1 clickhouse-client --query "SELECT 1" > /dev/null 2>&1; do sleep 1; done'
timeout 30 bash -c 'until docker compose exec -T clickhouse-shard-2 clickhouse-client --query "SELECT 1" > /dev/null 2>&1; do sleep 1; done'

- name: Run GolangCI linter
uses: golangci/golangci-lint-action@v9
with:
version: v2.1.6

- name: Start Workbench
uses: scality/workbench@v0.9.0

- name: Wait for ClickHouse setup and fix permissions
run: |
# Wait for workbench setup container to complete
timeout 60 bash -c 'until [ "$(docker inspect -f {{.State.Status}} workbench-setup-clickhouse 2>/dev/null)" = "exited" ]; do sleep 1; done'

# Wait for ClickHouse shards to be ready (workbench uses port 9002 internally)
for i in {1..30}; do
if docker exec workbench-clickhouse-shard-1 clickhouse-client --host localhost --port 9002 --query "SELECT 1" >/dev/null 2>&1; then
break
fi
sleep 2
done

for i in {1..30}; do
if docker exec workbench-clickhouse-shard-2 clickhouse-client --host localhost --port 9002 --query "SELECT 1" >/dev/null 2>&1; then
break
fi
sleep 2
done

- name: Run unit tests
run: make test-coverage

Expand All @@ -75,9 +87,3 @@ jobs:
run: |
workbench logs
workbench down

- name: Stop ClickHouse
if: always()
run: |
docker compose logs
docker compose down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ clean:

test: all
mkdir -p $(COVDATA_DIR)
COVDATA_DIR=$(COVDATA_DIR) go test $(COVER_TESTFLAGS) -v ./...
COVDATA_DIR=$(COVDATA_DIR) go test $(COVER_TESTFLAGS) -v ./cmd/... ./pkg/...

test-coverage: COVER_BUILDFLAGS=$(COVER_COMMONFLAGS)
test-coverage: COVER_TESTFLAGS=$(COVER_COMMONFLAGS) -coverprofile cover.out
Expand Down
23 changes: 0 additions & 23 deletions deployment/clickhouse-config.xml

This file was deleted.

50 changes: 0 additions & 50 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,4 @@
services:
clickhouse-shard-1:
image: docker.io/clickhouse/clickhouse-server:24.3.2.23-alpine
container_name: log-courier-clickhouse-shard-1
hostname: clickhouse-shard-1
ports:
- "9002:9000" # Native protocol
- "8123:8123" # HTTP interface
environment:
CLICKHOUSE_DB: logs
CLICKHOUSE_USER: default
CLICKHOUSE_PASSWORD: ""
volumes:
- clickhouse-shard-1-data:/var/lib/clickhouse
- ./deployment/clickhouse-config.xml:/etc/clickhouse-server/config.d/cluster.xml:ro
healthcheck:
test: ["CMD", "clickhouse-client", "--query", "SELECT 1"]
interval: 10s
timeout: 5s
retries: 5

clickhouse-shard-2:
image: docker.io/clickhouse/clickhouse-server:24.3.2.23-alpine
container_name: log-courier-clickhouse-shard-2
hostname: clickhouse-shard-2
ports:
- "9003:9000" # Native protocol
- "8124:8123" # HTTP interface
environment:
CLICKHOUSE_DB: logs
CLICKHOUSE_USER: default
CLICKHOUSE_PASSWORD: ""
volumes:
- clickhouse-shard-2-data:/var/lib/clickhouse
- ./deployment/clickhouse-config.xml:/etc/clickhouse-server/config.d/cluster.xml:ro
healthcheck:
test: ["CMD", "clickhouse-client", "--query", "SELECT 1"]
interval: 10s
timeout: 5s
retries: 5

log-courier:
build:
context: .
Expand All @@ -48,19 +8,9 @@ services:
network_mode: host
profiles:
- full
depends_on:
clickhouse-shard-1:
condition: service_healthy
clickhouse-shard-2:
condition: service_healthy
environment:
SUPERVISORD_CONF: supervisord.conf
volumes:
- ./deployment/conf/supervisord.conf:/conf/supervisord.conf:ro
- ./deployment/conf/env:/conf/env:ro

volumes:
clickhouse-shard-1-data:
driver: local
clickhouse-shard-2-data:
driver: local
15 changes: 8 additions & 7 deletions env/default/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ global:
log_level: info

features:
scuba:
enabled: false
enable_service_user: false

access_logging:
enabled: true

cloudserver:
image: ghcr.io/scality/cloudserver:7.70.77
image: ghcr.io/scality/cloudserver:9.2.14

vault:
image: ghcr.io/scality/vault:7.81.0
image: ghcr.io/scality/vault:7.83.0

s3_metadata:
image: ghcr.io/scality/metadata:8.19.0-standalone
image: ghcr.io/scality/metadata:9.0.0-standalone

clickhouse:
image: clickhouse/clickhouse-server:24.3.2.23-alpine
18 changes: 9 additions & 9 deletions pkg/logcourier/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,21 +423,21 @@ var _ = Describe("Processor", func() {
_ = testProcessor.Run(testCtx)
}()

// Wait for upload attempt
// Wait for upload to fail
Eventually(func() int64 {
return countingUploader.GetUploadCount()
return countingUploader.GetFailureCount()
}).WithTimeout(3 * time.Second).WithPolling(100 * time.Millisecond).Should(
BeNumerically(">=", 1),
)

uploadCount := countingUploader.GetUploadCount()
failureCount := countingUploader.GetFailureCount()
cancel()

// Verify only one upload attempt was made
Expect(uploadCount).To(Equal(int64(1)), "Should attempt upload exactly once")

// Verify the upload failed
failureCount := countingUploader.GetFailureCount()
Expect(failureCount).To(Equal(int64(1)), "Upload should have failed")

// Verify offset was not committed
Expand Down Expand Up @@ -505,21 +505,21 @@ var _ = Describe("Processor", func() {
_ = testProcessor.Run(testCtx)
}()

// Wait for upload attempt
// Wait for upload to fail
Eventually(func() int64 {
return countingUploader.GetUploadCount()
return countingUploader.GetFailureCount()
}).WithTimeout(3 * time.Second).WithPolling(100 * time.Millisecond).Should(
BeNumerically(">=", 1),
)

uploadCount := countingUploader.GetUploadCount()
failureCount := countingUploader.GetFailureCount()
cancel()

// Verify only one upload attempt was made
Expect(uploadCount).To(Equal(int64(1)), "Should attempt upload exactly once")

// Verify the upload failed
failureCount := countingUploader.GetFailureCount()
Expect(failureCount).To(Equal(int64(1)), "Upload should have failed")

// Verify offset was not committed
Expand Down Expand Up @@ -672,21 +672,21 @@ var _ = Describe("Processor", func() {
_ = testProcessor.Run(testCtx)
}()

// Wait for upload attempt
// Wait for upload to fail
Eventually(func() int64 {
return countingUploader.GetUploadCount()
return countingUploader.GetFailureCount()
}).WithTimeout(3 * time.Second).WithPolling(100 * time.Millisecond).Should(
BeNumerically(">=", 1),
)

uploadCount := countingUploader.GetUploadCount()
failureCount := countingUploader.GetFailureCount()
cancel()

// Verify only one upload attempt was made
Expect(uploadCount).To(Equal(int64(1)), "Should attempt upload exactly once")

// Verify the upload failed
failureCount := countingUploader.GetFailureCount()
Expect(failureCount).To(Equal(int64(1)), "Upload should have failed")

// Verify offset was not committed
Expand Down
4 changes: 2 additions & 2 deletions pkg/testutil/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ORDER BY (raftSessionID, bucketName, insertedAt, timestamp, req_id)

const schemaAccessLogsFederated = `
CREATE TABLE IF NOT EXISTS %s.access_logs_federated AS %s.access_logs
ENGINE = Distributed(test_cluster, %s, access_logs, raftSessionID)
ENGINE = Distributed(workbench_cluster, %s, access_logs, raftSessionID)
`

const schemaOffsetsLocal = `
Expand All @@ -86,7 +86,7 @@ ORDER BY (bucketName, raftSessionID)

const schemaOffsetsFederated = `
CREATE TABLE IF NOT EXISTS %s.offsets_federated AS %s.offsets
ENGINE = Distributed(test_cluster, %s, offsets, raftSessionID)
ENGINE = Distributed(workbench_cluster, %s, offsets, raftSessionID)
`

// ==========================================
Expand Down
Loading