OCL API 2

Build: #2047 failed

Job: Run tests failed

Stages & jobs

  1. Build

  2. Test

  3. Deploy for testing

    Requires a user to start manually
  4. Release

    Requires a user to start manually

Job result summary

Completed
Duration
8 minutes
Agent
xiao.openmrs.org
Revision
bacaff61fb58716e85346c110b3d244897cc7dfd bacaff61fb58716e85346c110b3d244897cc7dfd
Failing since
#2045 (Code changes detected – )
Fixed in
#2049 (Manual run from the stage: Release by Sunny Aggarwal.)
No failed test found. A possible compilation error occurred.

Error summary

The build generated some errors. See the full build log for more details.

    test_public_can_find_globally_without_compose ... ok
    test_public_can_view ... ok
    test_unable_to_represent_as_fhir ... Traceback (most recent call last):
  File "/code/core/value_sets/serializers.py", line 253, in to_representation
    IdentifierSerializer.include_ocl_identifier(instance.uri, RESOURCE_TYPE, rep)
  File "/code/core/common/serializers.py", line 141, in include_ocl_identifier
    return IdentifierSerializer.parse_identifier(ident)
  File "/code/core/common/serializers.py", line 88, in parse_identifier
    raise ValidationError(
rest_framework.exceptions.ValidationError: [ErrorDetail(string='Identifier must be in a format: /{owner_type}/{owner_id}/{resourceType}/{resource_id}/, given: /invalid/uri', code='invalid')]
Failed to represent "/invalid/uri" as ValueSet
ok
    test_update_with_compose ... ok
    test_validate_code ... ok
    test_validate_code_globally ... ok
    test_validate_code_globally_negative ... ok
    test_validate_code_globally_via_post ... ok
    test_validate_code_negative ... ok
core.tasks.tests.UtilsTest
    test_wait_until_task_complete_finished ... ok
    test_wait_until_task_complete_pending ... ok

======================================================================
FAIL: test_add_user (core.services.auth.tests.OpenIDAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/unittest/mock.py", line 1370, in patched
    return func(*newargs, **newkeywargs)
  File "/code/core/services/auth/tests.py", line 90, in test_add_user
    post_mock.assert_called_once_with(
  File "/usr/local/lib/python3.10/unittest/mock.py", line 931, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 919, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: post('/admin/realms/ocl/users', json={'enabled': True, 'emailVerified': True, 'firstName': 'First-280', 'lastName': 'Last-280', 'email': 'email280@test.com', 'username': 'username', 'credentials': <ANY>}, verify=False, headers={'Authorization': 'Bearer token'})
Actual: post('http://host.docker.internal:8080/admin/realms/OCL/users', json={'enabled': True, 'emailVerified': True, 'firstName': 'First-280', 'lastName': 'Last-280', 'email': 'email280@test.com', 'username': 'username', 'credentials': [{'type': 'password', 'hashedSaltedValue': 'tTDQLsdu8LOByFHNVMx6DLNpEbgsLdcF7Pwuw6fS2YE=', 'algorithm': 'pbkdf2-sha256', 'hashIterations': 600000, 'salt': 'RllEWE5NQjEwVmJ5eDhDZGpVdHhaNg==', 'temporary': False}]}, verify=False, headers={'Authorization': 'Bearer token'})

======================================================================
FAIL: test_exchange_code_for_token (core.services.auth.tests.OpenIDAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/unittest/mock.py", line 1370, in patched
    return func(*newargs, **newkeywargs)
  File "/code/core/services/auth/tests.py", line 48, in test_exchange_code_for_token
    post_mock.assert_called_once_with(
  File "/usr/local/lib/python3.10/unittest/mock.py", line 931, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 919, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: post('/realms/ocl/protocol/openid-connect/token', data={'grant_type': 'authorization_code', 'client_id': 'client-id', 'client_secret': 'client-secret', 'code': 'code', 'redirect_uri': 'http://localhost:4000'})
Actual: post('http://host.docker.internal:8080/realms/OCL/protocol/openid-connect/token', data={'grant_type': 'authorization_code', 'client_id': 'client-id', 'client_secret': 'client-secret', 'code': 'code', 'redirect_uri': 'http://localhost:4000'})

======================================================================
FAIL: test_get_admin_token (core.services.auth.tests.OpenIDAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/unittest/mock.py", line 1370, in patched
    return func(*newargs, **newkeywargs)
  File "/code/core/services/auth/tests.py", line 66, in test_get_admin_token
    post_mock.assert_called_once_with(
  File "/usr/local/lib/python3.10/unittest/mock.py", line 931, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 919, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: post('/realms/master/protocol/openid-connect/token', data={'grant_type': 'password', 'username': 'username', 'password': 'password', 'client_id': 'admin-cli'}, verify=False)
Actual: post('http://host.docker.internal:8080/realms/master/protocol/openid-connect/token', data={'grant_type': 'password', 'username': 'username', 'password': 'password', 'client_id': 'admin-cli'}, verify=False)

======================================================================
FAIL: test_get_login_redirect_url (core.services.auth.tests.OpenIDAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/code/core/services/auth/tests.py", line 26, in test_get_login_redirect_url
    self.assertEqual(
AssertionError: 'http://localhost:8080/realms/OCL/protocol[123 chars]4000' != '/realms/ocl/protocol/openid-connect/auth?[102 chars]4000'
- http://localhost:8080/realms/OCL/protocol/openid-connect/auth?response_type=code id_token&client_id=client-id&state=state&nonce=nonce&redirect_uri=http://localhost:4000
? ---------------------        ^^^
+ /realms/ocl/protocol/openid-connect/auth?response_type=code id_token&client_id=client-id&state=state&nonce=nonce&redirect_uri=http://localhost:4000
?         ^^^

======================================================================
FAIL: test_get_logout_redirect_url (core.services.auth.tests.OpenIDAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/code/core/services/auth/tests.py", line 33, in test_get_logout_redirect_url
    self.assertEqual(
AssertionError: 'http://localhost:8080/realms/OCL/protocol[93 chars]4000' != '/realms/ocl/protocol/openid-connect/logou[72 chars]4000'
- http://localhost:8080/realms/OCL/protocol/openid-connect/logout?id_token_hint=id-token-hint&post_logout_redirect_uri=http://localhost:4000
? ---------------------        ^^^
+ /realms/ocl/protocol/openid-connect/logout?id_token_hint=id-token-hint&post_logout_redirect_uri=http://localhost:4000
?         ^^^

----------------------------------------------------------------------
Ran 843 tests in 395.892s

FAILED (failures=5)
Preserving test database for alias 'default' ('test_postgres')...
1
Stopping ocl-oclapi2-rt_db_1 ...
Stopping ocl-oclapi2-rt_es_1 ...
Stopping ocl-oclapi2-rt_db_1 ... done
Stopping ocl-oclapi2-rt_es_1 ... done
Removing ocl-oclapi2-rt_db_1 ...
Removing ocl-oclapi2-rt_es_1 ...
Removing ocl-oclapi2-rt_es_1 ... done
Removing ocl-oclapi2-rt_db_1 ... done
Removing network ocl-oclapi2-rt_default
Removing volume ocl-oclapi2-rt_postgres-data
Removing volume ocl-oclapi2-rt_es-data
Removing volume ocl-oclapi2-rt_redis-data