Skip to content

Commit

Permalink
Merge Fix CI after ubuntu 18.04 stopped working (apache#1685)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-sucha committed Apr 20, 2023
2 parents a4fc89a + 0c28179 commit dcf45a1
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 60 deletions.
116 changes: 70 additions & 46 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,35 @@ on:
pull_request:
types: [ opened, synchronize, reopened ]

env:
CCM_VERSION: "6e71061146f7ae67b84ccd2b1d90d7319b640e4c"

jobs:
build:
name: Unit tests
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.19', '1.20' ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-VERSION: ${{ matrix.go }}
- uses: actions/cache@v2
id: gomod-cache
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
restore-keys: |
${{ runner.os }}-go-
go-version: ${{ matrix.go }}
- run: go vet
- name: Run unit tests
run: go test -tags unit -race
run: go test -v -tags unit -race
integration-cassandra:
timeout-minutes: 10
timeout-minutes: 15
needs:
- build
name: Integration Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: [ '1.19', '1.20' ]
cassandra_version: [ '3.0.27', '3.11.13' ]
cassandra_version: [ '4.0.8', '4.1.1' ]
auth: [ "false" ]
compressor: [ "snappy" ]
tags: [ "cassandra", "integration", "ccm" ]
Expand All @@ -56,7 +52,7 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Install CCM
run: pip install git+https://github.com/riptano/ccm.git@2.8.2
run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
- name: Start cassandra nodes
run: |
VERSION=${{ matrix.cassandra_version }}
Expand All @@ -70,66 +66,77 @@ jobs:
"client_encryption_options.truststore_password: cassandra"
"concurrent_reads: 2"
"concurrent_writes: 2"
"rpc_server_type: sync"
"rpc_min_threads: 2"
"rpc_max_threads: 2"
"write_request_timeout_in_ms: 5000"
"read_request_timeout_in_ms: 5000"
"enable_user_defined_functions: true"
)
if [[ $VERSION == 3.*.* ]]; then
conf+=(
"rpc_server_type: sync"
"rpc_min_threads: 2"
"rpc_max_threads: 2"
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
elif [[ $VERSION == 4.0.* ]]; then
conf+=(
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
else
conf+=(
"user_defined_functions_enabled: true"
"materialized_views_enabled: true"
)
fi
ccm remove test || true
ccm create test -v $VERSION -n 3 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
ccm updateconf "${conf[@]}"
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
ccm start --wait-for-binary-proto
ccm start --wait-for-binary-proto --verbose
ccm status
ccm node1 nodetool status
proto=4
if [[ $version == 3.*.* ]]; then
proto=5
fi
args="-gocql.timeout=60s -runssl -proto=$proto -rf=3 -clusterSize=3 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
args="-gocql.timeout=60s -runssl -proto=4 -rf=3 -clusterSize=3 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
echo "args=$args" >> $GITHUB_ENV
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
- name: Integration tests
run: |
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
go test -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
- name: 'Save ccm logs'
if: 'failure()'
uses: actions/upload-artifact@v3
with:
name: ccm-cluster
path: /home/runner/.ccm/test
retention-days: 5
integration-auth-cassandra:
timeout-minutes: 10
timeout-minutes: 15
needs:
- build
name: Integration Tests with auth
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: [ '1.19', '1.20' ]
cassandra_version: [ 3.11.13 ]
cassandra_version: [ '4.0.8' ]
compressor: [ "snappy" ]
tags: [ "integration" ]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v2
id: gomod-cache
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install CCM
run: pip install git+https://github.com/riptano/ccm.git@2.8.2
run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
- name: Start cassandra nodes
run: |
VERSION=${{ matrix.cassandra_version }}
Expand All @@ -143,16 +150,33 @@ jobs:
"client_encryption_options.truststore_password: cassandra"
"concurrent_reads: 2"
"concurrent_writes: 2"
"rpc_server_type: sync"
"rpc_min_threads: 2"
"rpc_max_threads: 2"
"write_request_timeout_in_ms: 5000"
"read_request_timeout_in_ms: 5000"
"authenticator: PasswordAuthenticator"
"authorizer: CassandraAuthorizer"
"enable_user_defined_functions: true"
)
if [[ $VERSION == 3.*.* ]]; then
conf+=(
"rpc_server_type: sync"
"rpc_min_threads: 2"
"rpc_max_threads: 2"
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
elif [[ $VERSION == 4.0.* ]]; then
conf+=(
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
else
conf+=(
"user_defined_functions_enabled: true"
"materialized_views_enabled: true"
)
fi
ccm remove test || true
ccm create test -v $VERSION -n 1 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
Expand All @@ -162,7 +186,7 @@ jobs:
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
ccm start --wait-for-binary-proto
ccm start --wait-for-binary-proto --verbose
ccm status
ccm node1 nodetool status
Expand All @@ -174,4 +198,4 @@ jobs:
- name: Integration tests
run: |
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
go test -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}
go test -v -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ Supported Versions

The following matrix shows the versions of Go and Cassandra that are tested with the integration test suite as part of the CI build:

Go/Cassandra | 3.0.x | 3.11.x | 4.0.x
-------------| ------| -------| --------
1.19 | yes | yes | WIP
1.20 | yes | yes | WIP

Gocql has been tested in production against many different versions of Cassandra. Due to limits in our CI setup we only
test against the latest 3 major releases, which coincides with the official support from the Apache project. We are
currently adding CI jobs against Cassandra 4.0.
| Go/Cassandra | 4.0.x | 4.1.x |
|--------------|-------|-------|
| 1.19 | yes | yes |
| 1.20 | yes | yes |

Gocql has been tested in production against many versions of Cassandra. Due to limits in our CI setup we only
test against the latest 2 GA releases.

Sunsetting Model
----------------
Expand Down
20 changes: 14 additions & 6 deletions cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,14 @@ func TestMaterializedViewMetadata(t *testing.T) {
if len(materializedViews) != 2 {
t.Fatal("expected two views")
}
expectedChunkLengthInKB := "16"
expectedDCLocalReadRepairChance := float64(0)
expectedSpeculativeRetry := "99p"
if flagCassVersion.Before(4, 0, 0) {
expectedChunkLengthInKB = "64"
expectedDCLocalReadRepairChance = 0.1
expectedSpeculativeRetry = "99PERCENTILE"
}
expectedView1 := MaterializedViewMetadata{
Keyspace: "gocql_test",
Name: "view_view",
Expand All @@ -2264,14 +2272,14 @@ func TestMaterializedViewMetadata(t *testing.T) {
Caching: map[string]string{"keys": "ALL", "rows_per_partition": "NONE"},
Comment: "",
Compaction: map[string]string{"class": "org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy", "max_threshold": "32", "min_threshold": "4"},
Compression: map[string]string{"chunk_length_in_kb": "64", "class": "org.apache.cassandra.io.compress.LZ4Compressor"},
Compression: map[string]string{"chunk_length_in_kb": expectedChunkLengthInKB, "class": "org.apache.cassandra.io.compress.LZ4Compressor"},
CrcCheckChance: 1,
DcLocalReadRepairChance: 0.1,
DcLocalReadRepairChance: expectedDCLocalReadRepairChance,
DefaultTimeToLive: 0,
Extensions: map[string]string{},
GcGraceSeconds: 864000,
IncludeAllColumns: false, MaxIndexInterval: 2048, MemtableFlushPeriodInMs: 0, MinIndexInterval: 128, ReadRepairChance: 0,
SpeculativeRetry: "99PERCENTILE",
SpeculativeRetry: expectedSpeculativeRetry,
}
expectedView2 := MaterializedViewMetadata{
Keyspace: "gocql_test",
Expand All @@ -2281,14 +2289,14 @@ func TestMaterializedViewMetadata(t *testing.T) {
Caching: map[string]string{"keys": "ALL", "rows_per_partition": "NONE"},
Comment: "",
Compaction: map[string]string{"class": "org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy", "max_threshold": "32", "min_threshold": "4"},
Compression: map[string]string{"chunk_length_in_kb": "64", "class": "org.apache.cassandra.io.compress.LZ4Compressor"},
Compression: map[string]string{"chunk_length_in_kb": expectedChunkLengthInKB, "class": "org.apache.cassandra.io.compress.LZ4Compressor"},
CrcCheckChance: 1,
DcLocalReadRepairChance: 0.1,
DcLocalReadRepairChance: expectedDCLocalReadRepairChance,
DefaultTimeToLive: 0,
Extensions: map[string]string{},
GcGraceSeconds: 864000,
IncludeAllColumns: false, MaxIndexInterval: 2048, MemtableFlushPeriodInMs: 0, MinIndexInterval: 128, ReadRepairChance: 0,
SpeculativeRetry: "99PERCENTILE",
SpeculativeRetry: expectedSpeculativeRetry,
}

expectedView1.BaseTableId = materializedViews[0].BaseTableId
Expand Down

0 comments on commit dcf45a1

Please sign in to comment.