Skip to content

Commit

Permalink
Merge pull request #109 from pnuu/example-end-to-end-test
Browse files Browse the repository at this point in the history
Example end-to-end test
  • Loading branch information
pnuu authored Dec 3, 2021
2 parents 4a2c132 + bf7bcc6 commit 76dd3f3
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
86 changes: 86 additions & 0 deletions examples/end-to-end-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Running an end-to-end test for Trollmoves scripts

This walkthrough demonstrates how to connect and test Trollmoves systems to each other.

It is assumed that Trollmoves and all the required packages have been installed.

## Start a nameserver
Run the following command in a terminal:

nameserver --no-multicast

We are disabling multicast to reduce the noise in the network.

## Start a Trollmoves Server

First, in a new terminal, create an input directory to use:

mkdir /tmp/server_input_directory

Start the Server process using the supplied configuration file:

move_it_server.py -v --disable-backlog -p 9011 server.ini

In another terminal, create a file in the input directory:

echo "Unladen swallow" > /tmp/server_input_directory/test1.txt

This should trigger the Server to publish a message.

## Start a Trollmoves Mirror

reate a new directory for storing the mirrored files temporarily:

mkdir /tmp/mirror_temporary_directory

Start the Mirror using the supplied configuration file:

move_it_mirror.py -p 9012 -v mirror.ini

In a new terminal, create another test file to the Server input directory:

echo "African swallow" > /tmp/server_input_directory/test2.txt

This should show that the Mirror got a message and re-published it.

## Start a Trollmoves Client

Create a target directory for the Client:

mkdir /tmp/client_target_directory

Start the Client using the supplied configuration file:

move_it_client.py -v client.ini

In a new terminal, create another test file:

echo "European swallow" > /tmp/server_input_directory/test3.txt

This should trigger Server and eventually Mirror to notify Client that there is a new file,
Client to make a request to Mirror, which requests the file from Server and forwards it to
the target directory of the Client.

## Forwarding the data with Dispatcher

Create a target directory for Dispatcher:

mkdir /tmp/dispatcher_target_directory

Start the Dispatcher:

dispatcher.py -v dispatch.yaml

In a new terminal, create yet another test file for the Server to host:

echo "Coconuts migrate?" > /tmp/input_directory/test4.txt

In the end the file should be in the following directories:

/tmp/server_input_directory
/tmp/client_target_directory
/tmp/dispatcher_target_directory

and exist temporarily also in:

/tmp/mirror_temporary_directory
6 changes: 6 additions & 0 deletions examples/end-to-end-test/client.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[client]
topic = /foo
providers = localhost:9012
destination = file:///tmp/client_target_directory/
publish_port = 9014
nameservers = localhost
10 changes: 10 additions & 0 deletions examples/end-to-end-test/dispatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dispatch_test:
host: file://localhost
connection_parameters:
connection_uptime: 60
filepattern: "{filename}.txt"
directory: "/tmp/dispatcher_target_directory/"
nameserver: localhost
dispatch_configs:
- topics:
- /foo
14 changes: 14 additions & 0 deletions examples/end-to-end-test/mirror.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[mirror]
# The client part of the config
providers = localhost:9011
destination = file:///tmp/mirror_temporary_directory/
client_topic = /foo
publish_port = 9012

# The server part of the config
origin = /tmp/mirror_temporary_directory/{filename}.txt
request_address = localhost
request_port = 9013
topic = /foo
delete = true

8 changes: 8 additions & 0 deletions examples/end-to-end-test/server.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[DEFAULT]
delete = False
# publish port: 9011

[server]
origin = /tmp/server_input_directory/{fname}.txt
topic = /foo
request_port = 9201

0 comments on commit 76dd3f3

Please sign in to comment.