Skip to content

Commit

Permalink
fix tests and README.me
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-b committed Sep 18, 2022
1 parent c6cab12 commit 1796a61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ NOMAD_CLIENT_KEY=/path/to/tls/client.key
* can either use the Vagrantfile for local integration testing or create environment variables `NOMAD_IP` and `NOMAD_PORT` that are assigned to a nomad binary that is running

```
virtualenv venv
source venv/bin/activate
virtualenv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
```

Expand Down
7 changes: 4 additions & 3 deletions tests/test_allocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ def test_get_allocations_with_namespace(nomad_setup_with_namespace):

@responses.activate
def test_get_allocations_with_namespace_override_namespace_declared_on_create(nomad_setup_with_namespace):
override_namespace_name = "namespace=override-namespace"
responses.add(
responses.GET,
"http://{ip}:{port}/v1/allocations?namespace={namespace}".format(ip=common.IP, port=common.NOMAD_PORT, namespace=common.NOMAD_NAMESPACE),
"http://{ip}:{port}/v1/allocations?prefix=a8198d79-cfdb-6593-a999-1e9adabcba2e&namespace={namespace}".format(ip=common.IP, port=common.NOMAD_PORT, namespace=override_namespace_name),
status=200,
json=[{"ID": "a8198d79-cfdb-6593-a999-1e9adabcba2e","EvalID": "5456bd7a-9fc0-c0dd-6131-cbee77f57577","Namespace": common.NOMAD_NAMESPACE, "Name": "example.cache[0]","NodeID": "fb2170a8-257d-3c64-b14d-bc06cc94e34c","PreviousAllocation": "516d2753-0513-cfc7-57ac-2d6fac18b9dc","NextAllocation": "cd13d9b9-4f97-7184-c88b-7b451981616b"}]
json=[{"ID": "a8198d79-cfdb-6593-a999-1e9adabcba2e","EvalID": "5456bd7a-9fc0-c0dd-6131-cbee77f57577","Namespace": override_namespace_name, "Name": "example.cache[0]","NodeID": "fb2170a8-257d-3c64-b14d-bc06cc94e34c","PreviousAllocation": "516d2753-0513-cfc7-57ac-2d6fac18b9dc","NextAllocation": "cd13d9b9-4f97-7184-c88b-7b451981616b"}]
)

nomad_setup_with_namespace.allocations.get_allocations("a8198d79-cfdb-6593-a999-1e9adabcba2e", namespace="override-namespace")
nomad_setup_with_namespace.allocations.get_allocations("a8198d79-cfdb-6593-a999-1e9adabcba2e", namespace=override_namespace_name)
7 changes: 4 additions & 3 deletions tests/test_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ def test_get_deployment_with_namespace(nomad_setup_with_namespace):

@responses.activate
def test_get_deployments_with_namespace_override_namespace_declared_on_create(nomad_setup_with_namespace):
override_namespace_name = "override-namespace"
responses.add(
responses.GET,
"http://{ip}:{port}/v1/deployment/a8198d79-cfdb-6593-a999-1e9adabcba2e?namespace={namespace}".format(ip=common.IP, port=common.NOMAD_PORT, namespace=common.NOMAD_NAMESPACE),
"http://{ip}:{port}/v1/deployments?prefix=a8198d79-cfdb-6593-a999-1e9adabcba2e&namespace={namespace}".format(ip=common.IP, port=common.NOMAD_PORT, namespace=override_namespace_name),
status=200,
json={"ID": "70638f62-5c19-193e-30d6-f9d6e689ab8e","JobID": "example", "JobVersion": 1, "JobModifyIndex": 17, "JobSpecModifyIndex": 17, "JobCreateIndex": 7,"Namespace": common.NOMAD_NAMESPACE, "Name": "example.cache[0]"}
json={"ID": "70638f62-5c19-193e-30d6-f9d6e689ab8e","JobID": "example", "JobVersion": 1, "JobModifyIndex": 17, "JobSpecModifyIndex": 17, "JobCreateIndex": 7,"Namespace": override_namespace_name, "Name": "example.cache[0]"}
)

nomad_setup_with_namespace.deployments.get_deployments("a8198d79-cfdb-6593-a999-1e9adabcba2e", namespace="override-namespace")
nomad_setup_with_namespace.deployments.get_deployments("a8198d79-cfdb-6593-a999-1e9adabcba2e", namespace=override_namespace_name)

0 comments on commit 1796a61

Please sign in to comment.