diff --git a/tests/test_playbooks/fixtures/sync_plans_role-0.yml b/tests/test_playbooks/fixtures/sync_plans_role-0.yml index a2ff133e3..760c1362f 100644 --- a/tests/test_playbooks/fixtures/sync_plans_role-0.yml +++ b/tests/test_playbooks/fixtures/sync_plans_role-0.yml @@ -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''; @@ -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: @@ -50,8 +50,6 @@ interactions: - none X-XSS-Protection: - 1; mode=block - content-length: - - '62' status: code: 200 message: OK @@ -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''; @@ -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: @@ -111,8 +108,6 @@ interactions: - none X-XSS-Protection: - 1; mode=block - content-length: - - '388' status: code: 200 message: OK @@ -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":[]} ' @@ -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''; @@ -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: @@ -170,8 +165,6 @@ interactions: - none X-XSS-Protection: - 1; mode=block - content-length: - - '151' status: code: 200 message: OK @@ -187,14 +180,13 @@ 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: @@ -202,6 +194,8 @@ interactions: - 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''; @@ -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: @@ -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 @@ -316,12 +244,12 @@ 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: @@ -329,6 +257,8 @@ interactions: - 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''; @@ -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: @@ -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 @@ -372,22 +300,19 @@ 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: @@ -395,6 +320,8 @@ interactions: - 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''; @@ -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: @@ -425,8 +350,6 @@ interactions: - none X-XSS-Protection: - 1; mode=block - content-length: - - '905' status: code: 200 message: OK diff --git a/tests/test_playbooks/sync_plans_role.yml b/tests/test_playbooks/sync_plans_role.yml index 517064d8f..8b08372e5 100644 --- a/tests/test_playbooks/sync_plans_role.yml +++ b/tests/test_playbooks/sync_plans_role.yml @@ -11,20 +11,17 @@ vars: organization_name: "Test Organization" organization_state: "present" - roles: - - role: repositories + - name: create products and repos + include_role: + name: repositories vars: foreman_organization: "Test Organization" foreman_products: - - name: Red Hat Enterprise Linux Server - repository_sets: - - name: Red Hat Satellite Tools 6.7 (for RHEL 7 Server) (RPMs) - basearch: x86_64 - - name: Red Hat Enterprise Linux 7 Server - Extras (RPMs) - basearch: x86_64 - - name: Red Hat Enterprise Linux for x86_64 - repository_sets: - - name: Red Hat Satellite Tools 6.7 for RHEL 8 x86_64 (RPMs) + - name: CentOS Stream 9 + repositories: + - name: BaseOS x86_64 + content_type: yum + url: https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/ - hosts: tests collections: @@ -41,5 +38,17 @@ interval: weekly sync_date: 2020-11-19 00:00:00 UTC products: - - Red Hat Enterprise Linux Server - - Red Hat Enterprise Linux for x86_64 + - CentOS Stream 9 + +- hosts: localhost + collections: + - theforeman.foreman + gather_facts: false + vars_files: + - vars/server.yml + tasks: + - name: delete test organization + include_tasks: tasks/organization.yml + vars: + organization_name: "Test Organization" + organization_state: "absent"