Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 18 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,43 @@ The goal of these test suites is to test which open source
Personal Data Store implementations comply with which protocol specs.

## Info on what each test suite tests
So far, there is only one test suite here, namely [webid-provider](./docs/webid-provider.md).
There are 3 Solid-related test suites, which are now maintained at
[https://github.com/solid/test-suite](https://github.com/solid/test-suite).

This repo currently only contains the open-cloud-mesh test suite, which
will probably at some point move to [https://github.com/cs3org](https://github.com/cs3org),
but during the development phase, we host it here.

## Running testers against servers in a Docker testnet

To summarize the test results, we have opted to build them in Docker
(this part was copied from [Solid's test-suite](https://github.com/solid/test-suite)),
and to run them within that. This documents how to run it:

Prerequisites: [Docker](https://docs.docker.com/install/)

Run the following commands in your command line terminal:

```sh
docker build -t webid-provider testers/webid-provider
docker build -t solid-crud testers/solid-crud
docker build -t open-cloud-mesh testers/open-cloud-mesh
docker network create testnet
mkdir -p reports

bash runTests.sh node-solid-server
bash runTests.sh solid-app-kit
bash runTests.sh php-solid-server
bash runTests.sh nextcloud-server

grep Tests reports/*
bash ./runOcmTests.sh
```

## Expected output

Note that nextcloud-server and php-solid-server do not have webid-provider functionality enabled yet (we are
still working on that). Therefore, the final output should look something like:
```sh
reports/nextcloud-server-solid-crud.txt:Tests: 73 failed, 73 total
reports/nextcloud-server-webid-provider.txt:Tests: 14 skipped, 35 passed, 49 total
reports/node-solid-server-solid-crud.txt:Tests: 25 failed, 48 passed, 73 total
reports/node-solid-server-webid-provider.txt:Tests: 14 skipped, 35 passed, 49 total
reports/php-solid-server-solid-crud.txt:Tests: 73 failed, 73 total
reports/php-solid-server-webid-provider.txt:Tests: 11 failed, 14 skipped, 24 passed, 49 total
reports/solid-app-kit-solid-crud.txt:Tests: 73 failed, 73 total
reports/solid-app-kit-webid-provider.txt:Tests: 35 failed, 14 skipped, 49 total
```

To run one tester against one server interactively, you can do for instance:
The final output should look something like:
```sh
./runTesterAgainstServer.sh webid-provider node-solid-server
[...]
root@f0c7e54fb1f3:/# npm run jest
root@f0c7e54fb1f3:/# exit
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 6.315 s
Ran all test suites.
[...]
```

## Running one of the servers and one of the testers interactively:
In one terminal:
```sh
./runServer.sh node-solid-server
# DEBUG=* ./bin/solid-test start
```

In another terminal:
```sh
./runTester.sh webid-provider node-solid-server
# ./node_modules/.bin/jest test/surface/token.test.ts
```

## Running one of the testers
Running the tester Docker images on a Mac outside a testnet will not work
straight-forwardly due to https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds.

But to run for instance the webid-provider tester against a URL, you can simply run it outside Docker:
```sh
cd testers/webid-provider/tester
npm install
NODE_TLS_REJECT_UNAUTHORIZED=0 ALICE_WEBID=https://localhost/profile/card#me SERVER_ROOT=https://localhost ./node_modules/.bin/jest test/surface/*
```
# To run a few servers in the testnet

## Running a server on https://localhost
```sh
docker run -d -p 443:443 nextcloud-server
```

## YMMV

Caveat 1: the qualities of a software product can of course not be counted with a simple number of passing tests,
so this list only gives a rough idea of levels of Solid spec compliance.

Caveat 2: not all servers may have been configured optimally in these test runs; if you know of ways to improve the
outcome for any of these servers, please provide a pull request.

Caveat 3: this test suite still incomplete and heavily biased towards LDP Basic container support.
./startServer.sh owncloud-server 8080
./startServer.sh nextcloud-server 443
./startServer.sh seafile-server 8080
```
6 changes: 6 additions & 0 deletions env-vars-server.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SERVER_ROOT=https://server
STORAGE_ROOT=https://server/apps/solid/@alice/storage
ALICE_WEBID=https://server/apps/solid/@alice/turtle#me
COOKIE_TYPE=nextcloud-compatible
USERNAME=alice
PASSWORD=alice123
10 changes: 10 additions & 0 deletions env-vars-testers.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
WEBID_ALICE=https://server/apps/solid/@alice/turtle#me
OIDC_ISSUER_ALICE=https://server
STORAGE_ROOT_ALICE=https://server/apps/solid/@alice/storage
WEBID_BOB=https://thirdparty/apps/solid/@alice/turtle#me
OIDC_ISSUER_BOB=https://thirdparty
STORAGE_ROOT_BOB=https://thirdparty/
ALICE_WEBID=https://server/apps/solid/@alice/turtle#me
SERVER_ROOT_ESCAPED=https:\/\/server
SERVER_ROOT=https://server
STORAGE_ROOT=https://server/apps/solid/@alice/storage
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const puppeteer = require("puppeteer");
const solidAuthFetcher = require("solid-auth-fetcher");

const SERVER_ROOT = process.env.SERVER_ROOT || "https://server";
const LOGIN_URL = `${SERVER_ROOT}/login`;
const USERNAME = process.env.USERNAME || "alice";
const PASSWORD = process.env.PASSWORD || "alice123";

async function getCookieNextcloudCompatible() {
const LOGIN_URL = `${SERVER_ROOT}/login`;
const browser = await puppeteer.launch({
ignoreHTTPSErrors: true,
headless: true,
Expand All @@ -26,7 +27,14 @@ async function getCookieNextcloudCompatible() {
}

async function run () {
const cookie = await getCookieNextcloudCompatible();
let cookie
if (process.env.SERVER_TYPE === 'nextcloud-server') {
cookie = await getCookieNextcloudCompatible();
} else if (process.env.SERVER_TYPE === 'node-solid-server') {
cookie = await solidAuthFetcher.getNodeSolidServerCookie(SERVER_ROOT, USERNAME, PASSWORD);
} else if (process.env.SERVER_TYPE === 'php-solid-server') {
cookie = await solidAuthFetcher.getNodeSolidServerCookie(SERVER_ROOT, USERNAME, PASSWORD);
}
console.log(cookie);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"puppeteer": "^5.3.1"
"puppeteer": "^5.3.1",
"solid-auth-fetcher": "^1.3.5"
}
}
48 changes: 48 additions & 0 deletions runOcmTests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
set -e

function setup {
docker network create testnet
docker build -t nextcloud-server servers/nextcloud-server/
docker pull michielbdejong/nextcloud-cookie
docker build -t open-cloud-mesh testers/open-cloud-mesh
}
function teardown {
docker stop `docker ps --filter network=testnet -q`
docker rm `docker ps --filter network=testnet -qa`
docker network remove testnet
}

function startSolidNextcloud {
docker run -d --name $1 --network=testnet --env-file ./env-vars-$1.list nextcloud-server
until docker run --rm --network=testnet open-cloud-mesh curl -kI https://$1 2> /dev/null > /dev/null
do
echo Waiting for $1 to start, this can take up to a minute ...
docker ps -a
docker logs $1
sleep 1
done

docker logs $1
echo Running init script for Nextcloud $1 ...
docker exec -u www-data -it -e SERVER_ROOT=https://$1 $1 sh /init.sh
docker exec -u root -it $1 service apache2 reload
echo Getting cookie for $1...
export COOKIE_$1="`docker run --cap-add=SYS_ADMIN --network=testnet --env-file ./env-vars-$1.list michielbdejong/nextcloud-cookie`"
}

function runTests {
echo "Running $1 tests against server with cookie $COOKIE_server"
docker run --rm --network=testnet \
--env COOKIE="$COOKIE_server" \
--env COOKIE_ALICE="$COOKIE_server" \
--env COOKIE_BOB="$COOKIE_thirdparty" \
--env-file ./env-vars-testers.list $1
}

# ...
teardown || true
setup
startSolidNextcloud server
runTests open-cloud-mesh
teardown
63 changes: 63 additions & 0 deletions runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,66 @@ docker run --network=testnet --env-file servers/$1/env.list solid-crud 2> report

echo Stopping server...
docker stop server
#!/bin/bash
set -e

echo Testing $1 ...
echo Building image ...
docker build -t $1 servers/$1

echo Starting server ...
docker run -d --name=server --env-file servers/$1/env.list --network=testnet $1

# echo Starting idp ...
# docker run --rm -d --name=idp --network=testnet node-solid-server

if [[ "$1" == community-solid-server ]]; then
until docker run --rm --network=testnet webid-provider curl -kI http://server:3000 2> /dev/null > /dev/null
do
echo Waiting for server to start, this can take up to a minute ...
docker ps -a
docker logs server || true
sleep 1
done
else
until docker run --rm --network=testnet webid-provider curl -kI https://server 2> /dev/null > /dev/null
do
echo Waiting for server to start, this can take up to a minute ...
docker ps -a
docker logs server || true
sleep 1
done
fi

if [[ "$1" == nextcloud-server ]]; then
echo Running init script for Nextcloud server ...
docker exec -u www-data -it server sh /init.sh
docker exec -u root -it server service apache2 reload
fi

if [[ "$1" == community-solid-server ]]; then
echo no cookie for community-solid-server
else
echo Getting cookie...
export COOKIE="`docker run --rm --cap-add=SYS_ADMIN --network=testnet --name cookie -e SERVER_TYPE=$1 --env-file servers/$1/env.list cookie`"
fi


# echo Running rdf-fixtures tester ...
# docker run --rm --network=testnet rdf-fixtures > reports/$1-rdf-fixtures.txt

echo Running webid-provider tester with cookie $COOKIE...
docker run --rm --network=testnet --name tester --env COOKIE="$COOKIE" --env-file servers/$1/env.list webid-provider 2> reports/$1-webid-provider.txt

echo Running solid-crud tester with cookie $COOKIE...
docker run --rm --network=testnet --name tester --env COOKIE="$COOKIE" --env-file servers/$1/env.list solid-crud 2> reports/$1-solid-crud.txt

# echo Running web-access-control tester with cookie $COOKIE...
# docker run --rm --network=testnet --name tester --env COOKIE="$COOKIE" --env-file servers/$1/env.list web-access-control 2> reports/$1-web-access-control.txt

echo Stopping server and idp...
docker stop server
# docker stop idp

echo Removing server...
docker rm server
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Dockerfile
env.list
.git
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ RUN openssl req -new -x509 -days 365 -nodes \
RUN apt-get update && apt-get install -yq \
git \
vim
WORKDIR /install
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"
WORKDIR /var/www/html
ADD init.sh /
EXPOSE 443
1 change: 0 additions & 1 deletion servers/nextcloud-server/base/.dockerignore

This file was deleted.

Loading