Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Commit 7ee33d0

Browse files
authored
Merge pull request #67 from orange-cloudfoundry/cassandra-acceptance-tests
Cassandra acceptance tests
2 parents 1d305b4 + 708128b commit 7ee33d0

File tree

11 files changed

+257
-1
lines changed

11 files changed

+257
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ output
2525

2626
/packages/*/dists/
2727
/*.patch
28-
/jobs/cassandra/*.patch
28+
/jobs/cassandra/*.patch

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "src/cf-cassandra-example-app"]
22
path = src/cf-cassandra-example-app
33
url = https://github.com/orange-cloudfoundry/cf-cassandra-example-app.git
4+
[submodule "src/github.com/orange-cloudfoundry/cassandra-acceptance-tests"]
5+
path = src/github.com/orange-cloudfoundry/cassandra-acceptance-tests
6+
url = https://github.com/orange-cloudfoundry/cassandra-acceptance-tests.git

cassandra.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
name: acc-tests
3+
4+
releases:
5+
- name: &cassandra_release cassandra-acc-tests
6+
version: latest
7+
8+
instance_groups:
9+
- name: cassandra-seeds
10+
instances: 1
11+
azs: [z1]
12+
jobs:
13+
- name: cassandra
14+
release: *cassandra_release
15+
provides:
16+
cassandra: { as: &cassandra_seeds_link cassandra_seeds_list }
17+
consumes:
18+
seeds: { from: *cassandra_seeds_link }
19+
properties: &cassandra_properties
20+
cluster_name: &cassandra_cluster_name cluster
21+
system_auth_keyspace_replication_factor: 3
22+
number_of_non_seeds_nodes: &number_of_non_seeds_nodes 2
23+
num_tokens: 256
24+
# internode_encryption_mode: none
25+
# client_encryption:
26+
# enabled: true
27+
# require_client_auth: true
28+
max_heap_size: 6G
29+
heap_newsize: 800M
30+
cass_pwd: ((cassandra_admin_password))
31+
# validate_ssl_TF: false
32+
cassDbCertificate:
33+
ca: ((cassandra_certificate_seeds.ca))
34+
private_key: ((cassandra_certificate_seeds.private_key))
35+
certificate: ((cassandra_certificate_seeds.certificate))
36+
cert:
37+
ca: ((cassandra_certificate_seeds))
38+
private_key: ((cassandra_certificate_seeds.private_key))
39+
certificate: ((cassandra_certificate_seeds.certificate))
40+
cass_KSP: ((cassandra_key_store_pass))
41+
cass_version: 3.11.1
42+
cass_upgrade_TF: false
43+
topology:
44+
# Don't bother these values, as they are not used yet, but ketp
45+
# here for future improments on the Cassandra BOSH Release.
46+
- 10.165.0.92=DC1:RAC1
47+
- 10.165.0.93=DC1:RAC1
48+
- 10.165.0.94=DC1:RAC1
49+
- 10.165.0.95=DC1:RAC1
50+
stemcell: *trusty_stemcell
51+
vm_type: &cassandra_vm_type large
52+
persistent_disk_type: &cassandra_persistent_disk_type small
53+
env:
54+
persistent_disk_fs: xfs
55+
bosh: { swap_size: 0 }
56+
networks:
57+
- name: cassandra-net
58+
59+
- name: cassandra-servers
60+
instances: *number_of_non_seeds_nodes
61+
azs: [z1]
62+
jobs:
63+
- name: cassandra
64+
release: *cassandra_release
65+
provides:
66+
cassandra: { as: &cassandra_servers_link cassandra_servers_list }
67+
consumes:
68+
seeds: { from: *cassandra_seeds_link }
69+
properties: *cassandra_properties
70+
stemcell: *trusty_stemcell
71+
vm_type: *cassandra_vm_type
72+
persistent_disk_type: *cassandra_persistent_disk_type
73+
env:
74+
persistent_disk_fs: xfs
75+
bosh: { swap_size: 0 }
76+
networks:
77+
- name: cassandra-net
78+
79+
- name: acceptance-tests
80+
release: *cassandra_release
81+
lifecycle: errand
82+
azs: [z1]
83+
instances: 1
84+
jobs:
85+
- name: cassandra-acceptance-tests
86+
consumes:
87+
cassandra_seeds_list: { from: *cassandra_seeds_link }
88+
cassandra_servers_list: { from: *cassandra_servers_link }
89+
release: *cassandra_release
90+
properties:
91+
cassandra_test_suites: [crud]
92+
vm_type: small
93+
stemcell: trusty
94+
networks:
95+
- name: cassandra-net
96+
97+
variables:
98+
- name: cassandra_admin_password
99+
type: password
100+
- name: /internalCA
101+
type: certificate
102+
options:
103+
is_ca: true
104+
common_name: internalCA
105+
- name: cassandra_certificate_seeds
106+
type: certificate
107+
options:
108+
ca: /internalCA
109+
common_name: <%= seed.instance.address %>
110+
alternative_names:
111+
- "*.cassandra-seeds.default.cassandra.bosh"
112+
extended_key_usage: [ client_auth, server_auth ]
113+
- name: cassandra_certificate_servers
114+
type: certificate
115+
options:
116+
ca: /internalCA
117+
common_name: <%= cluster.instance.address %>
118+
alternative_names:
119+
- "*.cassandra-servers.default.cassandra.bosh"
120+
extended_key_usage: [ client_auth, server_auth ]
121+
- name: cassandra_key_store_pass
122+
type: password
123+
124+
125+
update:
126+
serial: true # instance groups to be deployed sequentially.
127+
128+
canaries: 1
129+
canary_watch_time: 30000-240000
130+
# We don't support values >= 2 for 'max_in_flight'. Indeed there can
131+
# be a race condition in post-start when 2 repair-table are executed
132+
# in parallel.
133+
max_in_flight: 1
134+
update_watch_time: 30000-240000
135+
136+
stemcells:
137+
- alias: &trusty_stemcell trusty
138+
os: ubuntu-trusty
139+
version: latest

jobs/cassandra-acceptance-tests/monit

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: cassandra-acceptance-tests
2+
3+
packages:
4+
- golang-1.9-linux
5+
- cassandra-acceptance-tests
6+
7+
consumes:
8+
- name: cassandra_seeds_list
9+
type: cassandra
10+
- name: cassandra_servers_list
11+
type: cassandra
12+
13+
templates:
14+
config.json.erb: config.json
15+
errand.sh.erb: bin/run
16+
17+
properties:
18+
cassandra_test_suites:
19+
description: Test suites to run (["CRUD"] or ["replicaset_and_failover"])
20+
default: ["CRUD"]
21+
22+
timeout_scale:
23+
description: connection timeout (default 600ms)
24+
default: 10
25+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<%-
2+
servers_array = []
3+
link('cassandra_servers_list').instances.each do |instance|
4+
servers_array << "#{instance.address}"
5+
end
6+
7+
seeds_array = []
8+
link('cassandra_seeds_list').instances.each do |instance|
9+
seeds_array << "#{instance.address}"
10+
end
11+
12+
#servers_string = ''
13+
# link('cassandra_servers_list').instances.each do |instance|
14+
# servers_string = "#{servers_string}#{instance.address},"
15+
# end
16+
#servers_string = servers_string[0..2]
17+
18+
#seeds_string = ''
19+
#link('cassandra_seeds_list').instances.each do |instance|
20+
#seeds_string = "#{seeds_string}#{instance.address},"
21+
#end
22+
#seeds_string = seeds_string[0..2]
23+
24+
-%>
25+
{
26+
"timeout_scale": <%= p('timeout_scale') %>,
27+
"cluster_name": "<%= link('cassandra_seeds_list').p('cluster_name') %>",
28+
"cassandra_password": "<%= link('cassandra_seeds_list').p('cassandra_password') %>",
29+
"cassandra_native_transport_port": "<%= link('cassandra_seeds_list').p('native_transport_port') %>",
30+
"cassandra_seeds": <%= seeds_array.to_json %>,
31+
"cassandra_servers": <%= servers_array.to_json %>,
32+
"client_encryption.enabled" : <%= link('cassandra_seeds_list').p('client_encryption.enabled') %>,
33+
"keyspace_replication_factor": <%= link('cassandra_seeds_list').p('system_auth_keyspace_replication_factor', link('cassandra_seeds_list').instances.count) %>,
34+
"replication_strategy": "SimpleStrategy",
35+
"durable_write": true
36+
}
37+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
<%
3+
cassandra_test_suites = p('cassandra_test_suites')
4+
-%>
5+
set -e
6+
7+
pushd /var/vcap/packages/cassandra-acceptance-tests || exit 115
8+
source /var/vcap/packages/golang-1.9-linux/bosh/compile.env
9+
popd
10+
11+
export CATS_PKG_NAME=github.com/orange-cloudfoundry/cassandra-acceptance-tests
12+
export CATS_PKG_DIR=${GOPATH}/src/${CATS_PKG_NAME}
13+
14+
export CONFIG_PATH=/var/vcap/jobs/cassandra-acceptance-tests/config.json
15+
16+
pushd ${CATS_PKG_DIR}
17+
chmod +x ./bin/test
18+
19+
# Ginkgo compiles and runs binaries from /tmp which is 'noexec' on hardened
20+
# stemcells, so we use this as temporary directory instead.
21+
export TMPDIR=/var/vcap/data/tmp
22+
23+
./bin/test <%= cassandra_test_suites.join(' ') %>
24+
popd

jobs/cassandra/spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ provides:
1515
- client_encryption.require_client_auth
1616
- cert
1717
- cluster_name
18+
- system_auth_keyspace_replication_factor
1819

1920
consumes:
2021
- name: seeds
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -e # abort script on any command that exits with a non zero value
4+
5+
REPO_NAME=github.com/orange-cloudfoundry/cassandra-acceptance-tests
6+
7+
REPO_SOURCE_DIR=${REPO_NAME}
8+
REPO_TARGET_DIR=${BOSH_INSTALL_TARGET}/src/${REPO_NAME}
9+
10+
GINKGO_REPO_NAME=github.com/onsi/ginkgo
11+
GINKGO_SOURCE_DIR=${REPO_TARGET_DIR}/vendor/${GINKGO_REPO_NAME}
12+
GINKGO_TARGET_DIR=${BOSH_INSTALL_TARGET}/src/${GINKGO_REPO_NAME}
13+
14+
mkdir -p ${REPO_TARGET_DIR}
15+
mkdir -p ${GINKGO_TARGET_DIR}
16+
17+
cp -aR ${REPO_SOURCE_DIR}/* ${REPO_TARGET_DIR}
18+
cp -aR ${GINKGO_SOURCE_DIR}/* ${GINKGO_TARGET_DIR}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: cassandra-acceptance-tests
3+
4+
dependencies:
5+
- golang-1.9-linux
6+
7+
files:
8+
- github.com/orange-cloudfoundry/cassandra-acceptance-tests/**/*

0 commit comments

Comments
 (0)