Skip to content

Commit

Permalink
docs: update acceptance test docs (#4965)
Browse files Browse the repository at this point in the history
* docs: fix docs for running acceptance tests

docs: add makefile

docs: add README in acceptance level

docs: update configs

* Update README.md
  • Loading branch information
saw-jan authored Nov 22, 2024
1 parent 2041e81 commit 45ac7ca
Show file tree
Hide file tree
Showing 15 changed files with 372 additions and 96 deletions.
103 changes: 27 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![GoDoc](https://godoc.org/github.com/cs3org/reva?status.svg)](https://godoc.org/github.com/cs3org/reva)
[![Gitter chat](https://badges.gitter.im/cs3org/reva.svg)](https://gitter.im/cs3org/reva) [![Build Status](https://drone.cernbox.cern.ch/api/badges/cs3org/reva/status.svg)](https://drone.cernbox.cern.ch/cs3org/reva)
[![Go Report Card](https://goreportcard.com/badge/github.com/cs3org/reva)](https://goreportcard.com/report/github.com/cs3org/reva) [![codecov](https://codecov.io/gh/cs3org/reva/branch/master/graph/badge.svg)](https://codecov.io/gh/cs3org/reva) [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B11650%2Fcs3org%2Freva.svg?type=shield)](https://app.fossa.com/projects/custom%2B11650%2Fcs3org%2Freva?ref=badge_shield)
[![Gitter chat](https://badges.gitter.im/cs3org/reva.svg)](https://gitter.im/cs3org/reva) [![Build Status](https://drone.cernbox.cern.ch/api/badges/cs3org/reva/status.svg)](https://drone.cernbox.cern.ch/cs3org/reva)
[![Go Report Card](https://goreportcard.com/badge/github.com/cs3org/reva)](https://goreportcard.com/report/github.com/cs3org/reva) [![codecov](https://codecov.io/gh/cs3org/reva/branch/master/graph/badge.svg)](https://codecov.io/gh/cs3org/reva) [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B11650%2Fcs3org%2Freva.svg?type=shield)](https://app.fossa.com/projects/custom%2B11650%2Fcs3org%2Freva?ref=badge_shield)
================




![REVA Logo](https://raw.githubusercontent.com/cs3org/logos/efd3d2649478193e74f3de5a41247445941026b6/reva/logo.jpg)

REVA is an interoperability platform. It connects storage, sync and share platforms and application providers, and it does it in a vendor and platform neutral way by using the [CS3 APIS](https://github.com/cs3org/cs3apis).

## Installation

Head to [Documentation](https://reva.link) for documentation or [download](https://github.com/cs3org/reva/releases) to get the latest available release.

## Documentation & Support
Read the [getting started guide](https://reva.link/docs/getting-started/) and the other feature guides.

Read the [getting started guide](https://reva.link/docs/getting-started/) and the other feature guides.

## Build and run it yourself
You need to have [Go](https://golang.org/doc/install) (version 1.16 or higher), [git](https://git-scm.com/) and [make](https://en.wikipedia.org/wiki/Make_(software)) installed. Some of these commands may require `sudo`, depending on your system setup.

You need to have [Go](https://golang.org/doc/install) (version 1.16 or higher), [git](https://git-scm.com/) and [make](<https://en.wikipedia.org/wiki/Make_(software)>) installed. Some of these commands may require `sudo`, depending on your system setup.

#### Build

```
$ git clone https://github.com/cs3org/reva
$ git clone -b edge https://github.com/cs3org/reva
$ cd reva
$ make deps
$ make build
```

#### Run

```
$ mkdir -p /etc/revad
$ cp examples/storage-references/users.demo.json /etc/revad/users.json
$ cp examples/storage-references/groups.demo.json /etc/revad/groups.json
$ cp examples/storage-references/providers.demo.json /etc/revad/ocm-providers.json
$ cmd/revad/revad -dev-dir examples/storage-references
```

You can also read the [build from sources guide](https://reva.link/docs/getting-started/build-reva/) and the [setup tutorial](https://github.com/cs3org/reva/blob/master/docs/content/en/docs/tutorials/setup-tutorial.md).
Expand All @@ -55,12 +61,14 @@ To run all of them you can do `make test`.
If you see `TestGetManagerWithInvalidUser/Nil_in_user` fail, [try removing](https://github.com/cs3org/reva/issues/1736) `/etc/revad/users.json` on your system.

To run a single one of them you can do:

```sh
$ go test `go list ./pkg/utils/...`
ok github.com/cs3org/reva/v2/pkg/utils 0.374s
```

### Integration tests (GRPC)

See [tests/integration](https://github.com/cs3org/reva/tree/master/tests/integration).
This requires Redis.

Expand All @@ -74,9 +82,11 @@ You can get more verbose output with `ginkgo -v -r tests/integration/`.
NB: This will work better on Linux than on MacOS because of issues with static linking (`library not found for -lcrt0.o`).

### Litmus tests (WebDAV)

[Litmus](http://www.webdav.org/neon/litmus/) is a webdav test suite. The litmus tests for Reva's WebDAV interface are run using the [ownCloud's litmus Docker image](https://github.com/owncloud-docker/litmus). The '-old' and '-new' refer to which `LITMUS_URL` environment variable is passed to that Docker image, in other words, which path on the Reva server the litmus tests are run against.

1. start the needed services

```
mkdir -p /var/tmp/reva/einstein
cd tests/oc-integration-tests/local
Expand All @@ -88,6 +98,7 @@ NB: This will work better on Linux than on MacOS because of issues with static l
```

2. run litmus tests:

```
docker run --rm --network=host\
-e LITMUS_URL=http://localhost:20080/remote.php/webdav \
Expand All @@ -101,72 +112,12 @@ NB: This will work better on Linux than on MacOS because of issues with static l
- if on MacOS you see `FAIL (connection refused by '127.0.0.1' port 20080: Connection refused)`, it may be necessary to replace 'localhost' with your host IP address (e.g. `ipconfig getifaddr en0` or `sudo ifconfig | grep 192`)

### Acceptance tests (ownCloud legacy)
See [tests/acceptance](https://github.com/cs3org/reva/tree/master/tests/acceptance).

This will require some PHP-related tools to run, for instance on Ubuntu you will need `apt install -y php-xml php-curl composer`.

1. start an LDAP server
```
docker run --rm --hostname ldap.my-company.com \
-e LDAP_TLS_VERIFY_CLIENT=never \
-e LDAP_DOMAIN=owncloud.com \
-e LDAP_ORGANISATION=ownCloud \
-e LDAP_ADMIN_PASSWORD=admin \
--name docker-slapd \
-p 127.0.0.1:389:389 \
-p 636:636 -d osixia/openldap:1.3.0
```
2. start the needed services
```
cd tests/oc-integration-tests/local
../../../cmd/revad/revad -c frontend.toml &
../../../cmd/revad/revad -c gateway.toml &
../../../cmd/revad/revad -c shares.toml &
../../../cmd/revad/revad -c storage-shares.toml &
../../../cmd/revad/revad -c storage-home.toml &
../../../cmd/revad/revad -c storage-users.toml &
../../../cmd/revad/revad -c storage-publiclink.toml &
../../../cmd/revad/revad -c machine-auth.toml &
../../../cmd/revad/revad -c permissions-ocis-ci.toml &
../../../cmd/revad/revad -c ldap-users.toml
```
3. clone ownCloud Infinite Scale `OCIS`
```
git clone https://github.com/owncloud/ocis.git ./testrunner
```
4. to run the correct version of the testsuite check out the commit id from the `.drone.env` file
5. clone the testing app
```
git clone https://github.com/owncloud/testing.git ./testrunner/apps/testing
```
6. run the tests
```
cd testrunner
TEST_SERVER_URL='http://localhost:20080' \
OCIS_REVA_DATA_ROOT='/var/tmp/reva/' \
DELETE_USER_DATA_CMD="rm -rf /var/tmp/reva/data/nodes/root/* /var/tmp/reva/data/nodes/*-*-*-* /var/tmp/reva/data/blobs/*" \
SKELETON_DIR='./apps/testing/data/apiSkeleton' \
TEST_WITH_LDAP='true' \
REVA_LDAP_HOSTNAME='localhost' \
TEST_REVA='true' \
BEHAT_FILTER_TAGS='~@notToImplementOnOCIS&&~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@provisioning_api-app-required&&~@preview-extension-required&&~@local_storage&&~@skipOnOcis-OCIS-Storage&&~@skipOnOcis' \
EXPECTED_FAILURES_FILE=../reva/tests/acceptance/expected-failures-on-OCIS-storage.md \
make test-acceptance-from-core-api
```
This will run all tests that are relevant to reva.
To run a single test add `BEHAT_FEATURE=<feature file>` and specify the path to the feature file and an optional line number. For example: `BEHAT_FEATURE='tests/acceptance/features/apiWebdavUpload1/uploadFile.feature:12'`
Make sure to double check the paths if you are changing the `OCIS_REVA_DATA_ROOT`. The `DELETE_USER_DATA_CMD` needs to clean up the correct folders.

See [Running Acceptance Tests](https://github.com/cs3org/reva/tree/edge/tests/acceptance).

## Daily releases
On every commit on the master branch (including merged Pull Requests) a new release will be created and

On every commit on the master branch (including merged Pull Requests) a new release will be created and
available at [daily releases](https://reva-releases.web.cern.ch/reva-releases).

## Major versions
Expand All @@ -175,11 +126,11 @@ There are currently two major versions in active development.

### 1.x versions

The ``master`` branch is the stable development branch. Releases from master are tagged as 1.x.x versions following [semver](https://semver.org/).
The `master` branch is the stable development branch. Releases from master are tagged as 1.x.x versions following [semver](https://semver.org/).

### 2.x versions

The ``edge`` branch is used to develop the next version of this project. The edge branch is based on a new concept named "Spaces" and a new set of the CS3APIs are being implemented, making it **not compatible** with `master` branch. Releases from `edge` are tagged as *2.x.x* versions following [semver](https://semver.org/).
The `edge` branch is used to develop the next version of this project. The edge branch is based on a new concept named "Spaces" and a new set of the CS3APIs are being implemented, making it **not compatible** with `master` branch. Releases from `edge` are tagged as _2.x.x_ versions following [semver](https://semver.org/).

## Run it using Docker

Expand All @@ -203,8 +154,8 @@ portability of the applications and service extensions.
REVA is distributed under [Apache 2.0 license](https://github.com/cs3org/reva/blob/master/LICENSE).

## Logo
REVA logo's have been designed and contributed to the project by Eamon Maguire.

REVA logo's have been designed and contributed to the project by Eamon Maguire.

## Disclaimer

Expand Down
83 changes: 83 additions & 0 deletions tests/acceptance/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
.PHONY: help
help:
@echo "Usage: make [target]"
@echo "Available targets:"
@echo " reva Start reva with ocis storage"
@echo " reva-posix Start reva with posixfs storage"
@echo " reva-s3ng Start reva with s3ng storage"

CURR_DIR:=$(dir $(abspath $(firstword $(MAKEFILE_LIST))))
REVA_CMD:=$(abspath $(CURR_DIR)/../../cmd/revad/revad)
CONFIG_DIR:=$(abspath $(CURR_DIR)/../oc-integration-tests/local)

.PHONY: ldap
ldap:
@docker run --rm -d \
--name docker-slapd \
-e LDAP_TLS_VERIFY_CLIENT=never \
-e LDAP_DOMAIN=owncloud.com \
-e LDAP_ORGANISATION=ownCloud \
-e LDAP_ADMIN_PASSWORD=admin \
-p 389:389 \
-p 636:636 \
osixia/openldap:1.3.0

.PHONY: redis
redis:
@docker run --rm -d \
--name redis \
-e REDIS_DATABASES=1 \
-p 6379:6379 \
redis:6-alpine

.PHONY: ceph
ceph:
@docker run --rm -d \
--name ceph \
-e CEPH_DAEMON=demo \
-e NETWORK_AUTO_DETECT=1 \
-e MON_IP=0.0.0.0 \
-e CEPH_PUBLIC_NETWORK=0.0.0.0/0 \
-e RGW_NAME=localhost \
-e CEPH_DEMO_UID=test-user \
-e CEPH_DEMO_ACCESS_KEY=testadmin \
-e CEPH_DEMO_SECRET_KEY=testadmin \
-e CEPH_DEMO_BUCKET=test \
-p 8080:8080 \
ceph/daemon
@echo "Waiting for ceph to be ready..."
@while [ `curl -s http://localhost:8080 -w %{http_code} -o /dev/null` -ne 200 ]; do sleep 1; done

.PHONY: reva-services
reva-services:
@$(REVA_CMD) -c $(CONFIG_DIR)/frontend.toml &
@$(REVA_CMD) -c $(CONFIG_DIR)/gateway.toml &
@$(REVA_CMD) -c $(CONFIG_DIR)/shares.toml &
@$(REVA_CMD) -c $(CONFIG_DIR)/storage-shares.toml &
@$(REVA_CMD) -c $(CONFIG_DIR)/storage-publiclink.toml &
@$(REVA_CMD) -c $(CONFIG_DIR)/machine-auth.toml &
@$(REVA_CMD) -c $(CONFIG_DIR)/permissions-ocis-ci.toml &
@$(REVA_CMD) -c $(CONFIG_DIR)/ldap-users.toml &

.PHONY: reva
reva: ldap reva-services
@echo "Running reva with ocis storage"
@$(REVA_CMD) -c $(CONFIG_DIR)/storage-users.toml

.PHONY: reva-posix
reva-posix: ldap redis reva-services
@echo "Running reva with posixfs storage"
@$(REVA_CMD) -c $(CONFIG_DIR)/storage-users-posixfs.toml

.PHONY: reva-s3ng
reva-s3ng: ldap ceph reva-services
@echo "Running reva with posixfs storage"
@$(REVA_CMD) -c $(CONFIG_DIR)/storage-users-s3ng.toml

.PHONY: clean
clean:
@docker ps -q --filter "name=docker-slapd" | xargs -r docker stop
@docker ps -q --filter "name=redis" | xargs -r docker stop
@docker ps -q --filter "name=ceph" | xargs -r docker stop
@pkill revad || true
@rm -rf /tmp/reva
100 changes: 100 additions & 0 deletions tests/acceptance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
## Acceptance Tests (ownCloud Legacy)

This will require some PHP-related tools to run, for instance on Ubuntu you will need `apt install -y php-xml php-curl composer`.

1. [Build reva](https://github.com/cs3org/reva/tree/edge?tab=readme-ov-file#build)

2. Start the reva server (with ocis storage driver)

```bash
make reva
```

> **INFO:**
>
> You can run reva with other storage drivers.
>
> To run reva with `posix` storage driver:
>
> ```bash
> make reva-posix
> ```
>
> To run reva with `s3ng` storage driver:
>
> ```bash
> make reva-s3ng
> ```
3. Get ownCloud Infinite Scale `OCIS`
```bash
git clone https://github.com/owncloud/ocis.git ./testrunner
```
4. To run the correct version of the testsuite check out the commit id from the `.drone.env` file

```bash
cd testrunner
git checkout <commit-id>
```

5. Run the tests

```bash
TEST_SERVER_URL='http://localhost:20080' \
TEST_REVA='true' \
TEST_WITH_LDAP='true' \
OCIS_REVA_DATA_ROOT='/tmp/reva/' \
DELETE_USER_DATA_CMD="rm -rf /tmp/reva/data/nodes/root/* /tmp/reva/data/nodes/*-*-*-* /tmp/reva/data/blobs/*" \
SKELETON_DIR='./apps/testing/data/apiSkeleton' \
REVA_LDAP_HOSTNAME='localhost' \
BEHAT_FILTER_TAGS='~@skip&&~@skipOnReva' \
EXPECTED_FAILURES_FILE=<path-to-reva>/tests/acceptance/expected-failures-on-OCIS-storage.md \
DIVIDE_INTO_NUM_PARTS=1 \
RUN_PART=1 \
ACCEPTANCE_TEST_TYPE=core-api \
make test-acceptance-api
```

This will run all tests that are relevant to reva.

To run a single test add `BEHAT_FEATURE=<feature file>` and specify the path to the feature file and an optional line number.
For example:

```bash
...
BEHAT_FEATURE='tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature:20' \
make test-acceptance-api
```

**NOTE:**
Make sure to double check the paths if you are changing the `OCIS_REVA_DATA_ROOT`. The `DELETE_USER_DATA_CMD` needs to clean up the correct folders.

> **INFO:**
>
> Use these proper environment variables to run tests with different storage drivers:
>
> 1. Run tests with `s3ng` storage driver:
>
> ```bash
> ...
> DELETE_USER_DATA_CMD="rm -rf /tmp/reva/data/spaces/* /tmp/reva/data/blobs/* /tmp/reva/data/indexes/by-type/*" \
> EXPECTED_FAILURES_FILE=<path-to-reva>/tests/acceptance/expected-failures-on-S3NG-storage.md \
> make test-acceptance-api
> ```
>
> 2. Run tests with `posix` storage driver:
>
> ```bash
> ...
> DELETE_USER_DATA_CMD="bash -cx 'rm -rf /tmp/reva/data/users/* /tmp/reva/data/indexes/by-type/*'" \
> EXPECTED_FAILURES_FILE=<path-to-reva>/tests/acceptance/expected-failures-on-POSIX-storage.md \
> make test-acceptance-api
> ```
6. Cleanup the setup
```bash
make clean
```
6 changes: 3 additions & 3 deletions tests/oc-integration-tests/local/combined.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ users = "users.demo.json"
#expose_data_server = true

#[grpc.services.storageprovider.drivers.ocis]
#root = "/var/tmp/reva/data"
#root = "/tmp/reva/data"
#enable_home = false
#treetime_accounting = true
#treesize_accounting = true
Expand Down Expand Up @@ -186,9 +186,9 @@ max_chunk_size = 0

[http.services.dataprovider]
driver = "ocis"
temp_folder = "/var/tmp/reva/tmp"
temp_folder = "/tmp/reva/tmp"

[http.services.dataprovider.drivers.ocis]
root = "/var/tmp/reva/data"
root = "/tmp/reva/data"
treetime_accounting = true
treesize_accounting = true
Loading

0 comments on commit 45ac7ca

Please sign in to comment.