Skip to content

Commit

Permalink
fix sync plans role tests
Browse files Browse the repository at this point in the history
- the org needs to be created before the products (tasks run after roles)
- no need to use products that need subs
- delete org when we're done
  • Loading branch information
evgeni committed Sep 10, 2024
1 parent e27bcbf commit 221b0a1
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 138 deletions.
173 changes: 48 additions & 125 deletions tests/test_playbooks/fixtures/sync_plans_role-0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ interactions:
uri: https://foreman.example.org/api/status
response:
body:
string: '{"result":"ok","status":200,"version":"2.2.0","api_version":2}'
string: '{"result":"ok","status":200,"version":"3.13.0-develop","api_version":2}'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '71'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -33,13 +35,11 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.2.0
- 3.13.0-develop
Keep-Alive:
- timeout=15, max=100
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -50,8 +50,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '62'
status:
code: 200
message: OK
Expand All @@ -70,17 +68,18 @@ interactions:
uri: https://foreman.example.org/katello/api/organizations?search=name%3D%22Test+Organization%22&per_page=4294967296
response:
body:
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\
: 4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\"\
: {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\"\
:\"Test_Organization\",\"created_at\":\"2020-11-01 23:21:05 UTC\",\"updated_at\"\
:\"2020-11-18 01:36:09 UTC\",\"id\":3,\"name\":\"Test Organization\",\"title\"\
:\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
string: "{\n \"total\": 3,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\":
4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\":
{\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Organization\",\"created_at\":\"2024-09-04
06:20:59 UTC\",\"updated_at\":\"2024-09-06 18:26:54 UTC\",\"id\":4,\"name\":\"Test
Organization\",\"title\":\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '388'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -94,13 +93,11 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.2.0
- 3.13.0-develop
Keep-Alive:
- timeout=15, max=99
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -111,8 +108,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '388'
status:
code: 200
message: OK
Expand All @@ -128,10 +123,10 @@ interactions:
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: GET
uri: https://foreman.example.org/katello/api/organizations/3/sync_plans?search=name%3D%22Weekly+Sync%22&per_page=4294967296
uri: https://foreman.example.org/katello/api/organizations/4/sync_plans?search=name%3D%22Weekly+Sync%22&per_page=4294967296
response:
body:
string: '{"total":0,"subtotal":0,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Weekly
string: '{"total":0,"subtotal":0,"selectable":0,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Weekly
Sync\"","sort":{"by":"name","order":"asc"},"results":[]}
'
Expand All @@ -140,6 +135,8 @@ interactions:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '166'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -151,15 +148,13 @@ interactions:
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 3; Test Organization
- 4; Test Organization
Foreman_version:
- 2.2.0
- 3.13.0-develop
Keep-Alive:
- timeout=15, max=98
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -170,8 +165,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '151'
status:
code: 200
message: OK
Expand All @@ -187,21 +180,22 @@ interactions:
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: GET
uri: https://foreman.example.org/katello/api/organizations/3/products?search=name%3D%22Red+Hat+Enterprise+Linux+Server%22&per_page=4294967296
uri: https://foreman.example.org/katello/api/organizations/4/products?search=name%3D%22CentOS+Stream+9%22&per_page=4294967296
response:
body:
string: '{"total":291,"subtotal":1,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Red
Hat Enterprise Linux Server\"","sort":{"by":"name","order":"asc"},"results":[{"id":126,"cp_id":"69","name":"Red
Hat Enterprise Linux Server","label":"Red_Hat_Enterprise_Linux_Server","description":null,"provider_id":4,"sync_plan_id":null,"sync_summary":{},"gpg_key_id":null,"ssl_ca_cert_id":null,"ssl_client_cert_id":null,"ssl_client_key_id":null,"sync_state":null,"last_sync":"2020-11-18
01:41:16 UTC","last_sync_words":"about 13 hours","organization_id":3,"organization":{"name":"Test
Organization","label":"Test_Organization","id":3},"sync_plan":null,"repository_count":2}]}
string: '{"total":2,"subtotal":1,"selectable":1,"page":1,"per_page":"4294967296","error":null,"search":"name=\"CentOS
Stream 9\"","sort":{"by":"name","order":"asc"},"results":[{"id":2,"cp_id":"333600040080","name":"CentOS
Stream 9","label":"CentOS_Stream_9","description":null,"provider_id":5,"sync_plan_id":null,"sync_summary":{},"gpg_key_id":null,"ssl_ca_cert_id":null,"ssl_client_cert_id":null,"ssl_client_key_id":null,"sync_state":null,"last_sync":null,"last_sync_words":null,"organization_id":4,"organization":{"name":"Test
Organization","label":"Test_Organization","id":4},"sync_plan":null,"repository_count":1}]}
'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '611'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -213,15 +207,13 @@ interactions:
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 3; Test Organization
- 4; Test Organization
Foreman_version:
- 2.2.0
- 3.13.0-develop
Keep-Alive:
- timeout=15, max=97
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -232,70 +224,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '671'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json;version=2
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: GET
uri: https://foreman.example.org/katello/api/organizations/3/products?search=name%3D%22Red+Hat+Enterprise+Linux+for+x86_64%22&per_page=4294967296
response:
body:
string: '{"total":291,"subtotal":1,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Red
Hat Enterprise Linux for x86_64\"","sort":{"by":"name","order":"asc"},"results":[{"id":21,"cp_id":"479","name":"Red
Hat Enterprise Linux for x86_64","label":"Red_Hat_Enterprise_Linux_for_x86_64","description":null,"provider_id":4,"sync_plan_id":null,"sync_summary":{},"gpg_key_id":null,"ssl_ca_cert_id":null,"ssl_client_cert_id":null,"ssl_client_key_id":null,"sync_state":null,"last_sync":"2020-11-18
01:41:23 UTC","last_sync_words":"about 13 hours","organization_id":3,"organization":{"name":"Test
Organization","label":"Test_Organization","id":3},"sync_plan":null,"repository_count":1}]}
'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
style-src ''unsafe-inline'' ''self'''
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
- '2'
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 3; Test Organization
Foreman_version:
- 2.2.0
Keep-Alive:
- timeout=15, max=96
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Frame-Options:
- sameorigin
X-Permitted-Cross-Domain-Policies:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '683'
status:
code: 200
message: OK
Expand All @@ -316,19 +244,21 @@ interactions:
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: POST
uri: https://foreman.example.org/katello/api/organizations/3/sync_plans
uri: https://foreman.example.org/katello/api/organizations/4/sync_plans
response:
body:
string: ' {"id":2,"organization_id":3,"name":"Weekly Sync","description":null,"interval":"weekly","next_sync":"2020-11-19
00:00:00 UTC","sync_date":"2020-11-19 00:00:00 UTC","created_at":"2020-11-18
14:38:58 UTC","updated_at":"2020-11-18 14:38:58 UTC","enabled":true,"foreman_tasks_recurring_logic_id":2,"cron_expression":null,"products":[],"permissions":{"view_sync_plans":true,"edit_sync_plans":true,"destroy_sync_plans":true}}
string: ' {"id":1,"organization_id":4,"name":"Weekly Sync","description":null,"interval":"weekly","next_sync":"2024-09-12
00:00:00 UTC","sync_date":"2020-11-19 00:00:00 +0000","created_at":"2024-09-06
18:27:00 UTC","updated_at":"2024-09-06 18:27:00 UTC","enabled":true,"foreman_tasks_recurring_logic_id":4,"cron_expression":null,"products":[],"permissions":{"view_sync_plans":true,"edit_sync_plans":true,"destroy_sync_plans":true}}
'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '424'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -340,15 +270,13 @@ interactions:
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 3; Test Organization
- 4; Test Organization
Foreman_version:
- 2.2.0
- 3.13.0-develop
Keep-Alive:
- timeout=15, max=95
- timeout=15, max=96
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Transfer-Encoding:
- chunked
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -363,7 +291,7 @@ interactions:
code: 201
message: Created
- request:
body: '{"product_ids": [21, 126]}'
body: '{"product_ids": [2]}'
headers:
Accept:
- application/json;version=2
Expand All @@ -372,29 +300,28 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '26'
- '20'
Content-Type:
- application/json
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: PUT
uri: https://foreman.example.org/katello/api/organizations/3/sync_plans/2/add_products
uri: https://foreman.example.org/katello/api/organizations/4/sync_plans/1/add_products
response:
body:
string: ' {"id":2,"organization_id":3,"name":"Weekly Sync","description":null,"interval":"weekly","next_sync":"2020-11-19
00:00:00 UTC","sync_date":"2020-11-19 00:00:00 UTC","created_at":"2020-11-18
14:38:58 UTC","updated_at":"2020-11-18 14:38:58 UTC","enabled":true,"foreman_tasks_recurring_logic_id":2,"cron_expression":null,"products":[{"id":21,"cp_id":"479","name":"Red
Hat Enterprise Linux for x86_64","label":"Red_Hat_Enterprise_Linux_for_x86_64","description":null,"sync_state":null,"last_sync":"2020-11-18
01:41:23 UTC","last_sync_words":"about 13 hours","repository_count":1},{"id":126,"cp_id":"69","name":"Red
Hat Enterprise Linux Server","label":"Red_Hat_Enterprise_Linux_Server","description":null,"sync_state":null,"last_sync":"2020-11-18
01:41:16 UTC","last_sync_words":"about 13 hours","repository_count":2}],"permissions":{"view_sync_plans":true,"edit_sync_plans":true,"destroy_sync_plans":true}}
string: ' {"id":1,"organization_id":4,"name":"Weekly Sync","description":null,"interval":"weekly","next_sync":"2024-09-12
00:00:00 UTC","sync_date":"2020-11-19 00:00:00 +0000","created_at":"2024-09-06
18:27:00 UTC","updated_at":"2024-09-06 18:27:00 UTC","enabled":true,"foreman_tasks_recurring_logic_id":4,"cron_expression":null,"products":[{"id":2,"cp_id":"333600040080","name":"CentOS
Stream 9","label":"CentOS_Stream_9","description":null,"sync_state":null,"last_sync":null,"last_sync_words":null,"repository_count":1}],"permissions":{"view_sync_plans":true,"edit_sync_plans":true,"destroy_sync_plans":true}}
'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '604'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -406,15 +333,13 @@ interactions:
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 3; Test Organization
- 4; Test Organization
Foreman_version:
- 2.2.0
- 3.13.0-develop
Keep-Alive:
- timeout=15, max=94
- timeout=15, max=95
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -425,8 +350,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '905'
status:
code: 200
message: OK
Expand Down
Loading

0 comments on commit 221b0a1

Please sign in to comment.