run-integration-tests.sh 1.87 KB
Newer Older
Yunhua Koglin's avatar
Yunhua Koglin committed
1
#!/usr/bin/env bash
Yunhua Koglin's avatar
Yunhua Koglin committed
2
# from tests/aws-test/build-aws/ goes up to the tests dir.
Yunhua Koglin's avatar
Yunhua Koglin committed
3
cd ../../../
Yunhua Koglin's avatar
Yunhua Koglin committed
4

fabian serin's avatar
fabian serin committed
5
6
# Install venv for python3
apt-get install -y python3 python3-pip python3-venv
fabian serin's avatar
fabian serin committed
7

fabian serin's avatar
fabian serin committed
8
python3 -m venv env
Yunhua Koglin's avatar
Yunhua Koglin committed
9
source env/bin/activate
fabian serin's avatar
fabian serin committed
10
11
12
13
pip install --upgrade pip
pip install wheel pytest pytest-cov
pip install -r requirements.txt
pip install -r requirements_dev.txt
Yunhua Koglin's avatar
Yunhua Koglin committed
14
15
16

svc_url=$WELLBORE_DDMS_URL
tenant='opendes'
17
acl_domain='example.com'
18
legal_tag='opendes-wellddmstestlegaltag'
19
svctoken=$(python3 tests/aws-test/build-aws/aws_jwt_client.py)
Yunhua Koglin's avatar
Yunhua Koglin committed
20

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
echo 'Register Legal tag before Integration Tests ...'
curl --location --request POST "$LEGAL_URL"'legaltags' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer '"$svctoken" \
  --header 'content-type: application/json' \
  --header 'data-partition-id: opendes' \
  --data '{
        "name": "wellddmstestlegaltag",
        "description": "legal tag for Wellbore DMS Service Integration tests",
        "properties": {
            "countryOfOrigin":["US"],
            "contractId":"A1234",
            "expirationDate":"2099-01-25",
            "dataType":"Public Domain Data", 
            "originator":"MyCompany",
            "securityClassification":"Public",
            "exportClassification":"EAR99",
            "personalData":"No Personal Data"
        }
}'
Yunhua Koglin's avatar
Yunhua Koglin committed
41
42
cd tests/integration

fabian serin's avatar
fabian serin committed
43
python3 gen_postman_env.py --token $svctoken --base_url $svc_url --cloud_provider "aws" --acl_domain $acl_domain --legal_tag $legal_tag --data_partition $tenant
Yunhua Koglin's avatar
Yunhua Koglin committed
44

fabian serin's avatar
fabian serin committed
45
pytest ./functional --environment="./generated/postman_environment.json" --filter-tag=!search
46
#TEST_EXIT_CODE=$?
47
48
49
50
51

echo Delete legaltag after Integration Tests...
curl --location --request DELETE "$LEGAL_URL"'legaltags/opendes-wellddmstestlegaltag' \
--header 'Authorization: Bearer '"$svctoken" \
--header 'data-partition-id: opendes' \
Yunhua Koglin's avatar
Yunhua Koglin committed
52
--header 'Content-Type: application/json'
53

54
#deactivate
55

56
#exit $TEST_EXIT_CODE