Skip to content

Commit

Permalink
add ceph test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
zjregee committed Mar 3, 2024
1 parent 5f1d5d1 commit cdaf30e
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/services/swift/ceph_rados_swift/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: ceph_rados_swift
description: 'Behavior test for CEPH OBJECT GATEWAY Swift.'

runs:
using: "composite"
steps:
- name: Setup Ceph Rados Server
shell: bash
working-directory: fixtures/swift
run: docker compose -f docker-compose-ceph-rados.yml up -d --wait

- name: Create environment variables and setup test container
shell: bash
working-directory: fixtures/swift
run: |
docker exec ceph-demo radosgw-admin user create \
--subuser="test_user:test_swift_user" --uid="test_user" --display-name="test_user" \
--key-type=swift --secret="password" --access=full
response=$(curl -i -H "X-Auth-User: test_user:test_swift_user" -H "X-Auth-Key: password" http://127.0.0.1:8080/auth/v1)
token=$(echo "$response" | grep X-Auth-Token | head -n1 | awk '{print $2}' | tr -d '[:space:]')
endpoint=$(echo "$response" | grep X-Storage-Url | head -n1 | awk '{print $2}' | tr -d '[:space:]')
curl --location --request PUT "${endpoint}/testing" --header "X-Auth-Token: $token"
echo "OPENDAL_SWIFT_TOKEN=${token}" >> $GITHUB_ENV
echo "OPENDAL_SWIFT_ENDPOINT=${endpoint}" >> $GITHUB_ENV
- name: Set environment variables
shell: bash
run: |
cat << EOF >> $GITHUB_ENV
OPENDAL_SWIFT_CONTAINER=testing
OPENDAL_SWIFT_ROOT=/
EOF
44 changes: 44 additions & 0 deletions fixtures/swift/docker_compose-ceph-rados.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

version: "3.8"

services:
ceph-demo:
image: quay.io/ceph/demo
container_name: ceph-demo
environment:
- MON_IP=127.0.0.1
- CEPH_PUBLIC_NETWORK=0.0.0.0/0
- DEMO_DAEMONS=osd,mds,rgw
- CEPH_DEMO_UID=demo
- CEPH_DEMO_ACCESS_KEY=demo
- CEPH_DEMO_SECRET_KEY=demo
ports:
- "8080:8080"
- "5000:5000"
- "6789:6789"
volumes:
- ceph-vol:/var/lib/ceph/
network_mode: "host"
healthcheck:
test: [ "CMD", "radosgw-admin", "user", "list" ]
interval: 6s
retries: 100

volumes:
ceph-vol:

0 comments on commit cdaf30e

Please sign in to comment.