Skip to content

Commit 9e5c433

Browse files
committed
auth test
1 parent cd1af07 commit 9e5c433

File tree

7 files changed

+134
-263
lines changed

7 files changed

+134
-263
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ on:
77
pull_request:
88
types: [ opened, synchronize, reopened ]
99

10-
env:
11-
CCM_VERSION: "6e71061146f7ae67b84ccd2b1d90d7319b640e4c"
12-
1310
jobs:
1411
build:
1512
name: Unit tests
1613
runs-on: ubuntu-latest
1714
strategy:
1815
matrix:
19-
go: [ '1.20' ]
16+
go: [ '1.20', '1.21' ]
2017
steps:
2118
- uses: actions/checkout@v3
2219
- uses: actions/setup-go@v4
@@ -25,195 +22,21 @@ jobs:
2522
- run: go vet
2623
- name: Run unit tests
2724
run: go test -v -tags unit -race
28-
# integration-cassandra:
29-
# timeout-minutes: 15
30-
# needs:
31-
# - build
32-
# name: Integration Tests
33-
# runs-on: ubuntu-latest
34-
# strategy:
35-
# fail-fast: false
36-
# matrix:
37-
# go: [ '1.19', '1.20' ]
38-
# cassandra_version: [ '4.0.8', '4.1.1' ]
39-
# auth: [ "false" ]
40-
# compressor: [ "snappy" ]
41-
# tags: [ "cassandra", "integration", "ccm" ]
42-
# steps:
43-
# - uses: actions/checkout@v2
44-
# - uses: actions/setup-go@v2
45-
# with:
46-
# go-version: ${{ matrix.go }}
47-
# - uses: actions/cache@v2
48-
# id: gomod-cache
49-
# with:
50-
# path: ~/go/pkg/mod
51-
# key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
52-
# restore-keys: |
53-
# ${{ runner.os }}-go-
54-
# - name: Install CCM
55-
# run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
56-
# - name: Start cassandra nodes
57-
# run: |
58-
# VERSION=${{ matrix.cassandra_version }}
59-
# keypath="$(pwd)/testdata/pki"
60-
# conf=(
61-
# "client_encryption_options.enabled: true"
62-
# "client_encryption_options.keystore: $keypath/.keystore"
63-
# "client_encryption_options.keystore_password: cassandra"
64-
# "client_encryption_options.require_client_auth: true"
65-
# "client_encryption_options.truststore: $keypath/.truststore"
66-
# "client_encryption_options.truststore_password: cassandra"
67-
# "concurrent_reads: 2"
68-
# "concurrent_writes: 2"
69-
# "write_request_timeout_in_ms: 5000"
70-
# "read_request_timeout_in_ms: 5000"
71-
# )
72-
#
73-
# if [[ $VERSION == 3.*.* ]]; then
74-
# conf+=(
75-
# "rpc_server_type: sync"
76-
# "rpc_min_threads: 2"
77-
# "rpc_max_threads: 2"
78-
# "enable_user_defined_functions: true"
79-
# "enable_materialized_views: true"
80-
# )
81-
# elif [[ $VERSION == 4.0.* ]]; then
82-
# conf+=(
83-
# "enable_user_defined_functions: true"
84-
# "enable_materialized_views: true"
85-
# )
86-
# else
87-
# conf+=(
88-
# "user_defined_functions_enabled: true"
89-
# "materialized_views_enabled: true"
90-
# )
91-
# fi
92-
#
93-
# ccm remove test || true
94-
#
95-
# ccm create test -v $VERSION -n 3 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
96-
# ccm updateconf "${conf[@]}"
97-
#
98-
# export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
99-
#
100-
# ccm start --wait-for-binary-proto --verbose
101-
# ccm status
102-
# ccm node1 nodetool status
103-
#
104-
# args="-gocql.timeout=60s -runssl -proto=4 -rf=3 -clusterSize=3 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
105-
#
106-
# echo "args=$args" >> $GITHUB_ENV
107-
# echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
108-
# - name: Integration tests
109-
# run: |
110-
# export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
111-
# go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
112-
# - name: 'Save ccm logs'
113-
# if: 'failure()'
114-
# uses: actions/upload-artifact@v3
115-
# with:
116-
# name: ccm-cluster
117-
# path: /home/runner/.ccm/test
118-
# retention-days: 5
119-
# integration-auth-cassandra:
120-
# timeout-minutes: 15
121-
# needs:
122-
# - build
123-
# name: Integration Tests with auth
124-
# runs-on: ubuntu-latest
125-
# strategy:
126-
# fail-fast: false
127-
# matrix:
128-
# go: [ '1.19', '1.20' ]
129-
# cassandra_version: [ '4.0.8' ]
130-
# compressor: [ "snappy" ]
131-
# tags: [ "integration" ]
132-
#
133-
# steps:
134-
# - uses: actions/checkout@v3
135-
# - uses: actions/setup-go@v4
136-
# with:
137-
# go-version: ${{ matrix.go }}
138-
# - name: Install CCM
139-
# run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
140-
# - name: Start cassandra nodes
141-
# run: |
142-
# VERSION=${{ matrix.cassandra_version }}
143-
# keypath="$(pwd)/testdata/pki"
144-
# conf=(
145-
# "client_encryption_options.enabled: true"
146-
# "client_encryption_options.keystore: $keypath/.keystore"
147-
# "client_encryption_options.keystore_password: cassandra"
148-
# "client_encryption_options.require_client_auth: true"
149-
# "client_encryption_options.truststore: $keypath/.truststore"
150-
# "client_encryption_options.truststore_password: cassandra"
151-
# "concurrent_reads: 2"
152-
# "concurrent_writes: 2"
153-
# "write_request_timeout_in_ms: 5000"
154-
# "read_request_timeout_in_ms: 5000"
155-
# "authenticator: PasswordAuthenticator"
156-
# "authorizer: CassandraAuthorizer"
157-
# "enable_user_defined_functions: true"
158-
# )
159-
#
160-
# if [[ $VERSION == 3.*.* ]]; then
161-
# conf+=(
162-
# "rpc_server_type: sync"
163-
# "rpc_min_threads: 2"
164-
# "rpc_max_threads: 2"
165-
# "enable_user_defined_functions: true"
166-
# "enable_materialized_views: true"
167-
# )
168-
# elif [[ $VERSION == 4.0.* ]]; then
169-
# conf+=(
170-
# "enable_user_defined_functions: true"
171-
# "enable_materialized_views: true"
172-
# )
173-
# else
174-
# conf+=(
175-
# "user_defined_functions_enabled: true"
176-
# "materialized_views_enabled: true"
177-
# )
178-
# fi
179-
#
180-
# ccm remove test || true
181-
#
182-
# ccm create test -v $VERSION -n 1 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
183-
# ccm updateconf "${conf[@]}"
184-
#
185-
# rm -rf $HOME/.ccm/test/node1/data/system_auth
186-
#
187-
# export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
188-
#
189-
# ccm start --wait-for-binary-proto --verbose
190-
# ccm status
191-
# ccm node1 nodetool status
192-
#
193-
# args="-gocql.timeout=60s -runssl -proto=4 -rf=3 -clusterSize=1 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
194-
#
195-
# echo "args=$args" >> $GITHUB_ENV
196-
# echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
197-
# sleep 30s
198-
# - name: Integration tests
199-
# run: |
200-
# export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
201-
# go test -v -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}
202-
#
25+
20326
integration-testscontainers:
20427
needs: build
20528
runs-on: ubuntu-latest
206-
name: testcontainers-go
29+
name: integration-testscontainers
20730
strategy:
20831
matrix:
209-
go: [ '1.20' ]
32+
go: [ '1.20', '1.21' ]
21033
cassandra_version: [ '4.0.8', '4.1.1' ]
21134
auth: [ "false" ]
21235
compressor: [ "snappy" ]
21336
tags: [ "cassandra", "integration"]
21437
steps:
215-
- uses: actions/checkout@v2
216-
- uses: actions/setup-go@v2
38+
- uses: actions/checkout@v3
39+
- uses: actions/setup-go@v4
21740
with:
21841
go-version: ${{ matrix.go }}
21942
- name: setup
@@ -222,4 +45,28 @@ jobs:
22245
echo "args=$args" >> $GITHUB_ENV
22346
- name: run
22447
run: |
225-
go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
48+
go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
49+
50+
integration-auth-testscontainers:
51+
needs: build
52+
runs-on: ubuntu-latest
53+
name: integration-auth-testscontainers
54+
strategy:
55+
matrix:
56+
go: [ '1.20', '1.21' ]
57+
cassandra_version: [ '4.0.8', '4.1.1' ]
58+
auth: [ "false" ]
59+
compressor: [ "snappy" ]
60+
tags: [ "cassandra", "integration"]
61+
steps:
62+
- uses: actions/checkout@v3
63+
- uses: actions/setup-go@v4
64+
with:
65+
go-version: ${{ matrix.go }}
66+
- name: setup
67+
run: |
68+
args="-gocql.timeout=60s -runssl -proto=4 -rf=3 -clusterSize=1 -autowait=2000ms -runauth -compressor=${{ matrix.compressor }} -gocql.cversion=${{ matrix.cassandra_version }} ./..."
69+
echo "args=$args" >> $GITHUB_ENV
70+
- name: run
71+
run: |
72+
go test -v -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88

99
### Added
10-
10+
- Integrated testcontainers-go as the new test runner for integration tests.
1111
### Changed
12-
12+
- Updated GitHub workflows to use `testcontainers-go` for CCM integration tests, replacing the previous CCM integration test runner.
1313
### Fixed
14+
- Corrected `rpc_address` to `connect_address` in the `TestDiscoverViaProxy` test case.
1415

1516
## [1.6.0] - 2023-08-28
1617

NOTICE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,4 @@ Dmitry Kropachev <[email protected]>
182182
Oliver Boyle <[email protected]>
183183
Jackson Fleming <[email protected]> *
184184
Sylwia Szunejko <[email protected]> *
185+
Stanislav Bychkov <[email protected]>

go.mod

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,42 @@
1717
//
1818
module github.com/gocql/gocql
1919

20+
go 1.21
21+
2022
require (
21-
github.com/golang/snappy v0.0.3
23+
github.com/golang/snappy v0.0.4
2224
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed
23-
github.com/testcontainers/testcontainers-go v0.31.0
25+
github.com/testcontainers/testcontainers-go v0.32.0
2426
gopkg.in/inf.v0 v0.9.1
2527
)
2628

2729
require (
2830
dario.cat/mergo v1.0.0 // indirect
2931
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
30-
github.com/Microsoft/go-winio v0.6.1 // indirect
31-
github.com/Microsoft/hcsshim v0.11.4 // indirect
32-
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
32+
github.com/Microsoft/go-winio v0.6.2 // indirect
33+
github.com/Microsoft/hcsshim v0.11.5 // indirect
34+
github.com/bitly/go-hostpool v0.1.0 // indirect
3335
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
3436
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
35-
github.com/containerd/containerd v1.7.15 // indirect
37+
github.com/containerd/containerd v1.7.18 // indirect
38+
github.com/containerd/errdefs v0.1.0 // indirect
3639
github.com/containerd/log v0.1.0 // indirect
3740
github.com/cpuguy83/dockercfg v0.3.1 // indirect
38-
github.com/distribution/reference v0.5.0 // indirect
39-
github.com/docker/docker v25.0.5+incompatible // indirect
41+
github.com/distribution/reference v0.6.0 // indirect
42+
github.com/docker/docker v27.0.3+incompatible // indirect
4043
github.com/docker/go-connections v0.5.0 // indirect
4144
github.com/docker/go-units v0.5.0 // indirect
4245
github.com/felixge/httpsnoop v1.0.4 // indirect
4346
github.com/go-logr/logr v1.4.1 // indirect
4447
github.com/go-logr/stdr v1.2.2 // indirect
4548
github.com/go-ole/go-ole v1.2.6 // indirect
4649
github.com/gogo/protobuf v1.3.2 // indirect
47-
github.com/golang/protobuf v1.5.4 // indirect
4850
github.com/google/uuid v1.6.0 // indirect
49-
github.com/klauspost/compress v1.16.0 // indirect
51+
github.com/klauspost/compress v1.17.4 // indirect
5052
github.com/kr/text v0.2.0 // indirect
5153
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
5254
github.com/magiconair/properties v1.8.7 // indirect
55+
github.com/moby/docker-image-spec v1.3.1 // indirect
5356
github.com/moby/patternmatcher v0.6.0 // indirect
5457
github.com/moby/sys/sequential v0.5.0 // indirect
5558
github.com/moby/sys/user v0.1.0 // indirect
@@ -69,13 +72,9 @@ require (
6972
go.opentelemetry.io/otel v1.24.0 // indirect
7073
go.opentelemetry.io/otel/metric v1.24.0 // indirect
7174
go.opentelemetry.io/otel/trace v1.24.0 // indirect
72-
golang.org/x/crypto v0.22.0 // indirect
73-
golang.org/x/mod v0.16.0 // indirect
74-
golang.org/x/sys v0.19.0 // indirect
75-
golang.org/x/tools v0.13.0 // indirect
76-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d // indirect
77-
google.golang.org/grpc v1.58.3 // indirect
75+
golang.org/x/crypto v0.23.0 // indirect
76+
golang.org/x/sys v0.21.0 // indirect
77+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
78+
google.golang.org/grpc v1.64.1 // indirect
7879
google.golang.org/protobuf v1.33.0 // indirect
7980
)
80-
81-
go 1.21

0 commit comments

Comments
 (0)