Skip to content

Commit f39e1cd

Browse files
setup ci
1 parent a0b15ae commit f39e1cd

File tree

4 files changed

+99
-64
lines changed

4 files changed

+99
-64
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [ main, development/*, improvement/* ]
6+
pull_request:
7+
branches: [ main, development/* ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
mongodb:
15+
image: mongo:6.0
16+
ports:
17+
- 27017:27017
18+
options: >-
19+
--health-cmd "mongosh --eval 'db.adminCommand({ping: 1})'"
20+
--health-interval 10s
21+
--health-timeout 5s
22+
--health-retries 5
23+
24+
steps:
25+
- name: Checkout cloudserverclient
26+
uses: actions/checkout@v4
27+
with:
28+
path: cloudserverclient
29+
30+
- name: Checkout cloudserver
31+
uses: actions/checkout@v4
32+
with:
33+
repository: scality/cloudserver
34+
path: cloudserver
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '22'
40+
cache: 'yarn'
41+
cache-dependency-path: |
42+
cloudserverclient/yarn.lock
43+
cloudserver/yarn.lock
44+
45+
- name: Install cloudserver dependencies
46+
working-directory: cloudserver
47+
run: yarn install --frozen-lockfile --network-timeout 100000
48+
49+
- name: Start cloudserver in background
50+
working-directory: cloudserver
51+
run: |
52+
S3VAULT=mem S3METADATA=mongodb S3DATA=mem REMOTE_MANAGEMENT_DISABLE=true yarn start &
53+
echo $! > cloudserver.pid
54+
env:
55+
CI: true
56+
57+
- name: Wait for cloudserver to be ready
58+
run: |
59+
echo "Waiting for cloudserver to start..."
60+
timeout 60 bash -c 'until curl -f http://localhost:8000 2>/dev/null; do sleep 2; done'
61+
echo "Cloudserver is ready!"
62+
63+
- name: Install cloudserverclient dependencies
64+
working-directory: cloudserverclient
65+
run: yarn install --frozen-lockfile
66+
67+
- name: Build cloudserverclient
68+
working-directory: cloudserverclient
69+
run: yarn build
70+
71+
- name: Install test dependencies
72+
working-directory: cloudserverclient/tests
73+
run: yarn install --frozen-lockfile
74+
75+
- name: Run GetSingleObject test
76+
working-directory: cloudserverclient/tests
77+
run: yarn test testApis.test.ts -t "GetSingleObject"
78+
79+
- name: Stop cloudserver
80+
if: always()
81+
working-directory: cloudserver
82+
run: |
83+
if [ -f cloudserver.pid ]; then
84+
kill $(cat cloudserver.pid) || true
85+
fi

.github/workflows/docker-build.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

build/smithy/source/typescript-codegen/yarn.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testApis.test.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import assert from 'assert';
12
import {
23
CloudserverClient,
34
PutDataInput,
@@ -44,19 +45,16 @@ describe('CloudServer API Tests', () => {
4445
}
4546
});
4647

47-
it('should test GetObject', async () => {
48-
try {
49-
const getInput: GetObjectInput = {
50-
Bucket: testConfig.bucketName,
51-
Key: testConfig.objectKey,
52-
RequestUids: '123',
53-
};
54-
const getCommand = new GetObjectCommand(getInput);
55-
const getData = await client.send(getCommand);
56-
console.log('GetObject succeeded:', getData);
57-
} catch (err) {
58-
console.log('GetObject failed:', err);
59-
}
48+
it('should test GetSingleObject', async () => {
49+
const getInput: GetObjectInput = {
50+
Bucket: testConfig.bucketName,
51+
Key: testConfig.objectKey,
52+
RequestUids: '123',
53+
};
54+
const getCommand = new GetObjectCommand(getInput);
55+
const getData = await client.send(getCommand);
56+
console.log('GetObject succeeded:', getData);
57+
assert.equal(await getData.Body.transformToString(), 'Hey!!');
6058
});
6159

6260
it('should test GetObjectList', async () => {

0 commit comments

Comments
 (0)