Skip to content

Commit 7ccfc14

Browse files
committed
feat(ZENKO-1044): Add ceph backend tests
1 parent 04c987d commit 7ccfc14

35 files changed

+625
-126
lines changed

eve/main.yml

+70
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ models:
9696
s3:
9797
filename: /artifacts/s3.log
9898
follow: true
99+
- ShellCommand: &follow-s3-ceph-logs
100+
logfiles:
101+
ceph:
102+
filename: /artifacts/ceph.log
103+
follow: true
104+
s3:
105+
filename: /artifacts/s3.log
106+
follow: true
99107
- ShellCommand: &add-hostname
100108
name: add hostname
101109
command: |
@@ -104,6 +112,8 @@ models:
104112
"127.0.0.1 bucketwebsitetester.s3-website-us-east-1.amazonaws.com" \
105113
>> /etc/hosts
106114
haltOnFailure: True
115+
116+
107117
stages:
108118
pre-merge:
109119
worker:
@@ -121,6 +131,7 @@ stages:
121131
- file-ft-tests
122132
- multiple-backend-test
123133
- mongo-ft-tests
134+
- ceph-backend-tests
124135
waitForFinish: True
125136
haltOnFailure: True
126137

@@ -198,6 +209,65 @@ stages:
198209
<<: *multiple-backend-vars
199210
- Upload: *upload-artifacts
200211

212+
ceph-backend-tests:
213+
worker:
214+
type: kube_pod
215+
path: eve/workers/pod.yaml
216+
images:
217+
aggressor: eve/workers/build
218+
s3: "."
219+
ceph: eve/workers/ceph
220+
vars:
221+
aggressorMemLimit: "2Gi"
222+
s3MemLimit: "2Gi"
223+
redis: enabled
224+
env:
225+
<<: *multiple-backend-vars
226+
<<: *global-env
227+
CI_CEPH: enabled
228+
MPU_TESTING: "yes"
229+
S3_LOCATION_FILE: tests/locationConfig/locationConfigCeph.json
230+
steps:
231+
- Git: *clone
232+
- ShellCommand: *credentials
233+
- ShellCommand: *npm-install
234+
- ShellCommand:
235+
command: |
236+
bash -c "
237+
source /root/.aws/exports &> /dev/null
238+
set -ex
239+
bash eve/workers/ceph/wait_for_ceph.sh
240+
bash wait_for_local_port.bash 8000 40
241+
npm run multiple_backend_test"
242+
env:
243+
<<: *multiple-backend-vars
244+
<<: *global-env
245+
<<: *follow-s3-ceph-logs
246+
- ShellCommand:
247+
command: mvn test
248+
workdir: build/tests/functional/jaws
249+
<<: *follow-s3-ceph-logs
250+
env:
251+
<<: *multiple-backend-vars
252+
- ShellCommand:
253+
command: rspec tests.rb
254+
workdir: build/tests/functional/fog
255+
<<: *follow-s3-ceph-logs
256+
env:
257+
<<: *multiple-backend-vars
258+
- ShellCommand:
259+
command: |
260+
npm run ft_awssdk ||
261+
npm run ft_s3cmd ||
262+
npm run ft_s3curl
263+
env:
264+
<<: *file-mem-mpu
265+
<<: *global-env
266+
S3_LOCATION_FILE: "/kube_pod-prod-cloudserver-backend-0/\
267+
build/tests/locationConfig/locationConfigCeph.json"
268+
<<: *follow-s3-ceph-logs
269+
- Upload: *upload-artifacts
270+
201271
mongo-ft-tests:
202272
worker: &s3-pod
203273
type: kube_pod

eve/workers/ceph/Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ceph/daemon
2+
3+
ENV CEPH_DAEMON demo
4+
ENV CEPH_DEMO_DAEMONS mon,mgr,osd,rgw
5+
6+
ENV CEPH_DEMO_UID zenko
7+
ENV CEPH_DEMO_ACCESS_KEY accessKey1
8+
ENV CEPH_DEMO_SECRET_KEY verySecretKey1
9+
ENV CEPH_DEMO_BUCKET zenkobucket
10+
11+
ENV CEPH_PUBLIC_NETWORK 0.0.0.0/0
12+
ENV MON_IP 0.0.0.0
13+
ENV NETWORK_AUTO_DETECT 4
14+
ENV RGW_CIVETWEB_PORT 8001
15+
16+
ADD ./entrypoint-wrapper.sh /
17+
RUN chmod +x /entrypoint-wrapper.sh && \
18+
yum install -y python-pip && \
19+
yum clean all && \
20+
pip install awscli && \
21+
rm -rf /root/.cache/pip
22+
23+
ENTRYPOINT [ "/entrypoint-wrapper.sh" ]
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
touch /artifacts/ceph.log
4+
mkfifo /tmp/entrypoint_output
5+
# We run this in the background so that we can tail the RGW log after init,
6+
# because entrypoint.sh never returns
7+
bash entrypoint.sh > /tmp/entrypoint_output &
8+
entrypoint_pid="$!"
9+
while read -r line; do
10+
echo $line
11+
# When we find this line server has started
12+
if [ -n "$(echo $line | grep 'Creating bucket')" ]; then
13+
break
14+
fi
15+
done < /tmp/entrypoint_output
16+
17+
# Make our buckets - CEPH_DEMO_BUCKET is set to force the "Creating bucket" message, but unused
18+
s3cmd mb s3://cephbucket s3://cephbucket2
19+
20+
mkdir /root/.aws
21+
cat > /root/.aws/credentials <<EOF
22+
[default]
23+
aws_access_key_id = accessKey1
24+
aws_secret_access_key = verySecretKey1
25+
EOF
26+
27+
# Enable versioning on them
28+
for bucket in cephbucket cephbucket2; do
29+
echo "Enabling versiong for $bucket"
30+
aws --endpoint http://127.0.0.1:8001 s3api put-bucket-versioning --bucket $bucket --versioning Status=Enabled
31+
done
32+
tail -f /var/log/ceph/client.rgw.*.log | tee -a /artifacts/ceph.log
33+
wait $entrypoint_pid

eve/workers/ceph/wait_for_ceph.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
# This script is needed because RADOS Gateway
4+
# will open the port before beginning to serve traffic
5+
# causing wait_for_local_port.bash to exit immediately
6+
7+
echo 'Waiting for ceph'
8+
while [ -z "$(curl 127.0.0.1:8001 2>/dev/null)" ]; do
9+
sleep 1
10+
echo -n "."
11+
done

eve/workers/pod.yaml

+22-1
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,14 @@ spec:
8888
sleep 10 # wait for mongo
8989
/usr/src/app/docker-entrypoint.sh npm start | tee -a /artifacts/s3.log
9090
env:
91-
{% if vars.env.S3DATA is defined and vars.env.S3DATA == "multiple" -%}
91+
{% if vars.env.S3DATA is defined and vars.env.S3DATA == "multiple" and vars.env.CI_CEPH is not defined -%}
9292
- name: S3_LOCATION_FILE
9393
value: "/usr/src/app/tests/locationConfig/locationConfigTests.json"
9494
{%- endif %}
95+
{% if vars.env.S3DATA is defined and vars.env.S3DATA == "multiple" and vars.env.CI_CEPH is defined and vars.env.CI_CEPH == "enabled" -%}
96+
- name: S3_LOCATION_FILE
97+
value: "/usr/src/app/tests/locationConfig/locationConfigCeph.json"
98+
{%- endif %}
9599
- name: CI
96100
value: "true"
97101
- name: ENABLE_LOCAL_CACHE
@@ -153,6 +157,23 @@ spec:
153157
squid -f /etc/squid/squid.conf -N -z
154158
squid -f /etc/squid/squid.conf -NYCd 1
155159
{%- endif %}
160+
{% if vars.env.CI_CEPH is defined and vars.env.CI_CEPH == "enabled" -%}
161+
- name: ceph
162+
image: {{ images.ceph }}
163+
imagePullPolicy: IfNotPresent
164+
resources:
165+
requests:
166+
cpu: 250m
167+
memory: 512Mi
168+
limits:
169+
cpu: 500m
170+
memory: 1Gi
171+
volumeMounts:
172+
- name: artifacts
173+
readOnly: false
174+
mountPath: /artifacts
175+
{%- endif %}
176+
156177
volumes:
157178
- name: creds
158179
emptyDir: {}

tests/functional/aws-node-sdk/test/multipleBackend/delete/deleteAwsVersioning.js

+21-8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const {
2020
awsGetLatestVerId,
2121
getAwsRetry,
2222
genUniqID,
23+
isCEPH,
2324
} = require('../utils');
2425

2526
const someBody = 'testbody';
@@ -151,8 +152,11 @@ describeSkipIfNotMultiple('AWS backend delete object w. versioning: ' +
151152
(awsVerId, next) => delAndAssertResult(s3, { bucket,
152153
key, versionId: 'null', resultType: deleteVersion },
153154
err => next(err, awsVerId)),
154-
(awsVerId, next) => _awsGetAssertDeleted({ key,
155-
versionId: awsVerId, errorCode: 'NoSuchVersion' }, next),
155+
(awsVerId, next) => {
156+
const wanted = isCEPH ? 'NoSuchKey' : 'NoSuchVersion';
157+
_awsGetAssertDeleted({ key,
158+
versionId: awsVerId, errorCode: wanted }, next);
159+
},
156160
], done);
157161
});
158162

@@ -184,8 +188,11 @@ describeSkipIfNotMultiple('AWS backend delete object w. versioning: ' +
184188
(awsVerId, next) => delAndAssertResult(s3, { bucket,
185189
key, versionId: 'null', resultType: deleteVersion },
186190
err => next(err, awsVerId)),
187-
(awsVerId, next) => _awsGetAssertDeleted({ key,
188-
versionId: awsVerId, errorCode: 'NoSuchVersion' }, next),
191+
(awsVerId, next) => {
192+
const wanted = isCEPH ? 'NoSuchKey' : 'NoSuchVersion';
193+
_awsGetAssertDeleted({ key,
194+
versionId: awsVerId, errorCode: wanted }, next);
195+
},
189196
], done);
190197
});
191198

@@ -200,8 +207,11 @@ describeSkipIfNotMultiple('AWS backend delete object w. versioning: ' +
200207
(s3VerId, awsVerId, next) => delAndAssertResult(s3, { bucket,
201208
key, versionId: s3VerId, resultType: deleteVersion },
202209
err => next(err, awsVerId)),
203-
(awsVerId, next) => _awsGetAssertDeleted({ key,
204-
versionId: awsVerId, errorCode: 'NoSuchVersion' }, next),
210+
(awsVerId, next) => {
211+
const wanted = isCEPH ? 'NoSuchKey' : 'NoSuchVersion';
212+
_awsGetAssertDeleted({ key,
213+
versionId: awsVerId, errorCode: wanted }, next);
214+
},
205215
], done);
206216
});
207217

@@ -451,8 +461,11 @@ describeSkipIfNotMultiple('AWS backend delete object w. versioning: ' +
451461
err => next(err, awsVid)),
452462
(awsVid, next) => _getAssertDeleted(s3, { key,
453463
errorCode: 'NoSuchKey' }, () => next(null, awsVid)),
454-
(awsVerId, next) => _awsGetAssertDeleted({ key,
455-
versionId: awsVerId, errorCode: 'NoSuchVersion' }, next),
464+
(awsVerId, next) => {
465+
const wanted = isCEPH ? 'NoSuchKey' : 'NoSuchVersion';
466+
_awsGetAssertDeleted({ key,
467+
versionId: awsVerId, errorCode: wanted }, next);
468+
},
456469
], done);
457470
});
458471

tests/functional/aws-node-sdk/test/multipleBackend/delete/deleteAzure.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const async = require('async');
44
const BucketUtility = require('../../../lib/utility/bucket-util');
55
const withV4 = require('../../support/withV4');
66
const {
7-
describeSkipIfNotMultiple,
7+
describeSkipIfNotMultipleOrCeph,
88
uniqName,
99
getAzureClient,
1010
getAzureContainerName,
@@ -25,7 +25,7 @@ const nonExistingId = process.env.AWS_ON_AIR ?
2525
'MhhyTHhmZ4cxSi4Y9SMe5P7UJAz7HLJ9' :
2626
'3939393939393939393936493939393939393939756e6437';
2727

28-
describeSkipIfNotMultiple('Multiple backend delete object from Azure',
28+
describeSkipIfNotMultipleOrCeph('Multiple backend delete object from Azure',
2929
function testSuite() {
3030
this.timeout(250000);
3131
withV4(sigCfg => {

tests/functional/aws-node-sdk/test/multipleBackend/delete/deleteGcp.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const assert = require('assert');
33
const withV4 = require('../../support/withV4');
44
const BucketUtility = require('../../../lib/utility/bucket-util');
55
const {
6-
describeSkipIfNotMultiple,
6+
describeSkipIfNotMultipleOrCeph,
77
gcpLocation,
88
gcpLocationMismatch,
99
genUniqID,
@@ -17,7 +17,8 @@ const mismatchObject = `mismatchObject-${genUniqID()}`;
1717
const body = Buffer.from('I am a body', 'utf8');
1818
const bigBody = Buffer.alloc(10485760);
1919

20-
describeSkipIfNotMultiple('Multiple backend delete', function testSuite() {
20+
describeSkipIfNotMultipleOrCeph('Multiple backend delete',
21+
function testSuite() {
2122
this.timeout(120000);
2223
withV4(sigCfg => {
2324
let bucketUtil;

tests/functional/aws-node-sdk/test/multipleBackend/get/getAzure.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const BucketUtility = require('../../../lib/utility/bucket-util');
44
const withV4 = require('../../support/withV4');
55

66
const {
7-
describeSkipIfNotMultiple,
7+
describeSkipIfNotMultipleOrCeph,
88
uniqName,
99
getAzureClient,
1010
getAzureContainerName,
@@ -21,7 +21,7 @@ const normalBody = Buffer.from('I am a body', 'utf8');
2121

2222
const azureTimeout = 10000;
2323

24-
describeSkipIfNotMultiple('Multiple backend get object from Azure',
24+
describeSkipIfNotMultipleOrCeph('Multiple backend get object from Azure',
2525
function testSuite() {
2626
this.timeout(30000);
2727
withV4(sigCfg => {

tests/functional/aws-node-sdk/test/multipleBackend/get/getGcp.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const assert = require('assert');
22
const withV4 = require('../../support/withV4');
33
const BucketUtility = require('../../../lib/utility/bucket-util');
44
const {
5-
describeSkipIfNotMultiple,
5+
describeSkipIfNotMultipleOrCeph,
66
gcpLocation,
77
gcpLocationMismatch,
88
genUniqID,
@@ -50,7 +50,7 @@ describe('Multiple backend get object', function testSuite() {
5050
});
5151
});
5252

53-
describeSkipIfNotMultiple('with objects in GCP', () => {
53+
describeSkipIfNotMultipleOrCeph('with objects in GCP', () => {
5454
before(() => {
5555
process.stdout.write('Putting object to GCP\n');
5656
return s3.putObjectAsync({ Bucket: bucket, Key: gcpObject,
@@ -124,7 +124,7 @@ describe('Multiple backend get object', function testSuite() {
124124
});
125125
});
126126

127-
describeSkipIfNotMultiple('with bucketMatch set to false', () => {
127+
describeSkipIfNotMultipleOrCeph('with bucketMatch set to false', () => {
128128
beforeEach(done => {
129129
s3.putObject({ Bucket: bucket, Key: mismatchObject, Body: body,
130130
Metadata: { 'scal-location-constraint': gcpLocationMismatch } },

tests/functional/aws-node-sdk/test/multipleBackend/initMPU/initMPUAzure.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const assert = require('assert');
33

44
const withV4 = require('../../support/withV4');
55
const BucketUtility = require('../../../lib/utility/bucket-util');
6-
const { describeSkipIfNotMultiple, azureLocation, getAzureContainerName,
6+
const { describeSkipIfNotMultipleOrCeph, azureLocation, getAzureContainerName,
77
genUniqID } = require('../utils');
88

99
const keyName = `somekey-${genUniqID()}`;
@@ -12,7 +12,7 @@ const azureContainerName = getAzureContainerName(azureLocation);
1212
let s3;
1313
let bucketUtil;
1414

15-
describeSkipIfNotMultiple('Initiate MPU to AZURE', () => {
15+
describeSkipIfNotMultipleOrCeph('Initiate MPU to AZURE', () => {
1616
withV4(sigCfg => {
1717
beforeEach(() => {
1818
bucketUtil = new BucketUtility('default', sigCfg);

tests/functional/aws-node-sdk/test/multipleBackend/initMPU/initMPUGcp.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const assert = require('assert');
33

44
const withV4 = require('../../support/withV4');
55
const BucketUtility = require('../../../lib/utility/bucket-util');
6-
const { describeSkipIfNotMultiple, gcpClient, gcpBucketMPU, gcpLocation,
6+
const { describeSkipIfNotMultipleOrCeph, gcpClient, gcpBucketMPU, gcpLocation,
77
genUniqID } = require('../utils');
88
const { createMpuKey } =
99
require('../../../../../../lib/data/external/GCP').GcpUtils;
@@ -14,7 +14,7 @@ const keyName = `somekey-${genUniqID()}`;
1414
let s3;
1515
let bucketUtil;
1616

17-
describeSkipIfNotMultiple('Initiate MPU to GCP', () => {
17+
describeSkipIfNotMultipleOrCeph('Initiate MPU to GCP', () => {
1818
withV4(sigCfg => {
1919
beforeEach(() => {
2020
bucketUtil = new BucketUtility('default', sigCfg);

0 commit comments

Comments
 (0)