Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing - create script which simulates setup of a project #57

Closed
10 tasks done
Hagellach37 opened this issue Jan 23, 2019 · 8 comments
Closed
10 tasks done

Testing - create script which simulates setup of a project #57

Hagellach37 opened this issue Jan 23, 2019 · 8 comments

Comments

@Hagellach37
Copy link
Member

Hagellach37 commented Jan 23, 2019

  • we need to make sure to have an user
  • the script should take an import and insert it to firebase
  • the trigger the run_import function to import the project in firebase, create groups etc and do the stuff in postgres
  • simulate results for the imported project
  • get projects
  • get group per project
  • randomly generate results for tasks
  • run transfer results
  • run update
  • run export
@Hagellach37 Hagellach37 added this to the Enable new project types milestone Jan 23, 2019
@Hagellach37 Hagellach37 added this to To do in Enable new project types via automation Jan 23, 2019
@Matthias-Schaub
Copy link
Contributor

Matthias-Schaub commented Jan 23, 2019

Precondition for testing:

  • One single sample_data.json containing all project types
    • The json-field submission_key has to match the submission key of the configuration (cfg/config.cfg). Either the user has to change it manually or a test script will parse it from the configuration file it write it to the sample_data.json

First Steps for a testing script:

  • Upload the sample data to Firebase
  • Run the import process
  • Generate mock results for imported sample projects
  • Upload the sample results to Firebase

@Matthias-Schaub Matthias-Schaub changed the title create script which simulates setup of a project Testing - create script which simulates setup of a project Jan 23, 2019
@Matthias-Schaub Matthias-Schaub self-assigned this Jan 23, 2019
@Hagellach37 Hagellach37 moved this from To do to In progress in Enable new project types Feb 5, 2019
Hagellach37 added a commit that referenced this issue Feb 5, 2019
@Matthias-Schaub
Copy link
Contributor

Matthias-Schaub commented Feb 14, 2019

  • Make sure every test data, which is generated in firebase, postgres and locally by the test scripts is deleted. Right now test_terminat.py will delete all data in firebase and postgres. Be careful!

@Matthias-Schaub
Copy link
Contributor

See documentation for how to run tests:
https://mapswipe-workers.readthedocs.io/en/benni.new-project-types/testing.html

@Hagellach37
Copy link
Member Author

we are going to run the tests in the dev environment. We need to adjust this in the setup. (make sure modus="development")

@Hagellach37
Copy link
Member Author

Hagellach37 commented Feb 18, 2019

mock results is not working for me in a docker container:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/Pyrebase-3.0.27-py3.6.egg/pyrebase/pyrebase.py", line 264, in get
    raise_detailed_error(request_object)
  File "/usr/local/lib/python3.6/site-packages/Pyrebase-3.0.27-py3.6.egg/pyrebase/pyrebase.py", line 448, in raise_detailed_error
    raise HTTPError(e, request_object.text)
requests.exceptions.HTTPError: [Errno 400 Client Error: Bad Request for url: https://dev-mapswipe.firebaseio.com/groups/13528/groups/13528.json?orderBy=%2522completedCount%2522&limitToFirst=5] {
  "error" : "orderBy must be a valid JSON encoded path"
}

we can also create this error by:

from mapswipe_workers.basic import BaseFunctions
modus = 'development'
firebase, postgres = BaseFunctions.get_environment(modus)
fb_db = firebase.database()
project_id = 13528
groups = fb_db.child("groups").child(project_id).order_by_child("completedCount").limit_to_first(5).get()

It is super weird that the second string is causing the trouble, whereas for "groups" everything goes fine.

@Hagellach37
Copy link
Member Author

@Matthias-Schaub
Copy link
Contributor

Matthias-Schaub commented Feb 19, 2019

There is a new GitHub issue of Pyrebase describing this behaivor as well:
thisbejim/Pyrebase#294

They are referencing to a temporarly fix of the original Firebase Database REST API.
https://firebase.google.com/docs/reference/rest/database/
But i am not sure if this can help us. We should try the solutions of the above mentioned GitHub Issue:

At least in this documentation it is written, that their will be an update to fix this problem:
"Query parameters in URLs require additional header: Query parameters in URLs aren't parsed correctly
[...]
This workaround is temporary. An update expected in February 2019 will resolve issues with parsing URLs in query parameters."

@Hagellach37
Copy link
Member Author

  • make sure that test export does not overwrite other existing datasets, e.g. users.json or stats.json. Ideally tests would use a different DATA_PATH.

Hagellach37 pushed a commit that referenced this issue Feb 25, 2019
Enable new project types automation moved this from In progress to Done Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

3 participants