Merge "switch drools pdp image to new one"
[integration.git] / test / mocks / datafilecollector-testharness / mr-sim / README.md
1
2 #Alternative to running python (as described below) on your machine, use the docker files.
3 1. Build docker container with ```docker build -t mrsim:latest .```
4 2. Run the container ```docker-compose up```
5 The behavior can be changed by argument to the python script in the docker-compose.yml
6
7 The simulator can be queried for statistics
8 localhost:2222/ctr_requests   - return an integer of the number of get request to the event poll path
9 localhost:2222/ctr_responses  - return an integer of the number of get responses to the event poll path
10 localhost:2222/ctr_unique_files - returns an integer or the number of unique files. A unique file is the combination of node+file_sequence_number 
11
12
13 ##Common TC info
14 File names for 1MB, 5MB and 50MB files
15 Files in the format: <size-in-mb>MB_<sequence-number>.tar.gz    Ex. for 5MB file with sequence number 12:  5MB_12.tar.gz
16 The sequence numbers are stepped so that all files have unique names
17 Missing files (files that are not expected to be found in the ftp server. Format: MissingFile_<sequence-number>.tar.gz
18
19 Limited event streams
20 When the number of events are exhausted, empty replies are returned '[]'
21
22 TC100 - One ME, SFTP, 1 1MB file, 1 event
23 TC101 - One ME, SFTP, 1 5MB file, 1 event
24 TC102 - One ME, SFTP, 1 50MB file, 1 event
25
26 TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.
27 TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.
28 TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.
29 TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.
30
31
32 TC120 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json
33 TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files
34 TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. 
35
36 Endless event streams
37 TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll
38 TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll
39
40
41 TC510 - 5 ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.
42
43
44 TC200-TC202 same as TC100-TC102 but with FTPS
45 TC210-TC213 same as TC110-TC113 but with FTPS
46 TC2000-TC2001 same as TC1000-TC1001 but with FTPS
47 TC610 same as TC510 but with FTPS
48
49
50 ## Developer workflow
51
52 1. ```sudo apt install python3-venv```
53 2. ```source .env/bin/activate/```
54 3. ```pip3 install "anypackage"```      #also include in source code
55 4. ```pip3 freeze | grep -v "pkg-resources" > requirements.txt```   #to create a req file
56 5. ```FLASK_APP=mr-sim.py flask run```
57
58     or
59
60    ```python3 mr-sim.py ```
61
62 6. Check/lint/format the code before commit/amed by ```autopep8 --in-place --aggressive --aggressive mr-sim.py```
63
64
65 ## User workflow on *NIX
66
67
68 When cloning/fetching from the repository first time:
69 1. `git clone`
70 2. `cd "..." `          #navigate to this folder
71 3. `source setup.sh `   #setting up virtualenv and install requirements
72
73     you'll get a sourced virtualenv shell here, check prompt
74 4. `(env) $ python3 mr-sim.py --help`
75
76     alternatively
77
78     `(env) $ python3 mr-sim.py --tc1`
79
80 Every time you run the script, you'll need to step into the virtualenv by following step 3 first.
81
82 ## User workflow on Windows
83
84 When cloning/fetching from the repository first time:
85
86 1. 'git clone'
87 2. then step into the folder
88 3. 'pip3 install virtualenv'
89 4. 'pip3 install virtualenvwrapper-win'
90 5. 'mkvirtualenv env'
91 6. 'workon env'
92 7. 'pip3 install -r requirements.txt'   #this will install in the local environment then
93 8. 'python3 dfc-sim.py'
94
95 Every time you run the script, you'll need to step into the virtualenv by step 2+6.