package
0.0.0-20251002150433-a7953f424c49
Repository: https://github.com/cozy/cozy-stack.git
Documentation: pkg.go.dev

# README

Tools for system tests

Install

apt install ruby ruby-dev
gem install bundler
cd cozy-stack
go install
cd tests/system
bundle install
npm install -g @bitwarden/[email protected]

Optional: install MailHog

Automated tests

To launch an automated scenario of tests:

bundle exec ruby tests/push_folder.rb -v

The tests clean the logs and databases from the previous runs when they start, but does no cleaning on exit. You can inspect them to find what can have gone wrong for example. If you just want to clean those because you have finish your testing sessions, you can run this command:

bundle exec ruby clean.rb

You can also run the tests in parallel with:

go run parallel-runner.go -n 3 -fail-fast

Interactive mode

It's possible to do manual tests and to use the tools in an interactive mode to setup the sharing, create and update documents, etc.

bundle exec ./console.rb

Example of session:

b = Bootstrap.push_folder
ap b.sharing
b.open
b.accept
b.recipients.first.open

Compare trees

It can be useful for debugging to compare tree with a visual representation. You can generate an image with this ruby code:

Debug.visualize_tree [inst, inst_recipient], sharing

Swift

It's complicated to launch the tests with Swift, but it's possible to simulate it with swifttest:

$ go run ./tests/swift
$ cd tests/system
$ export COZY_SWIFTTEST=1
$ bundle exec ruby tests/sharing_push_folder.rb

REST Client

The Ruby library used for making HTTP requests is REST Client. It can be told to log requests by setting an environment variable:

$ export RESTCLIENT_LOG=stdout

Logs

The log files for the stack are kept inside the tmp/ directory. You can use lnav tool to view them. The log format of cozy-stack can installed with:

lnav -i cozy-stack/scripts/lnav_cozy_log.json