Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of community modules without integration tests #988

Open
11 of 39 tasks
alinabuzachis opened this issue Mar 14, 2022 · 5 comments
Open
11 of 39 tasks

List of community modules without integration tests #988

alinabuzachis opened this issue Mar 14, 2022 · 5 comments
Labels
feature This issue/PR relates to a feature request has_pr needs_triage

Comments

@alinabuzachis
Copy link
Contributor

alinabuzachis commented Mar 14, 2022

Summary

The following modules do not have integrations tests:

  • application_scaling_policy
  • batch_compute_environment
  • batch_job_definition
  • batch_job_queue
  • cloudfront_distribution_info (cloudfront_distribution tests also broken)
  • cloudfront_invalidation
  • cloudfront_origin_access_identity
  • cloudwatchevent_rule
  • cloudwatchlogs_log_group_info
  • data_pipeline
  • directconnect_confirm_connection
  • directconnect_connection
  • directconnect_gateway
  • directconnect_link_aggregation_group
  • directconnect_virtual_interface
  • dynamodb_ttl
  • ec2_ami_copy
  • ec2_asg_lifecycle_hook
  • ec2_customer_gateway
  • ec2_customer_gateway_info
  • ec2_snapshot_copy
  • ec2_vpc_vgw_info
  • ec2_vpc_vpn
  • ec2_win_password
  • ecs_attribute
  • elasticache_info
  • elasticache_parameter_group
  • elasticache_snapshot
  • elb_target_group_info
  • iam_mfa_device_info (no matching iam_mfa_device module)
  • lambda_event
  • rds_instance_snapshot
  • rds_snapshot_info
  • redshift_cross_region_snapshots
  • s3_cors
  • s3_website
  • storagegateway_info (no matching storagegateway module)
  • sts_session_token (needs access to a user/password - may need to be unsupported)

Issue Type

Feature Idea

Component Name

Several modules

Additional Information

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request has_pr needs_triage labels Mar 14, 2022
@tremble tremble pinned this issue Mar 14, 2022
@marknet15
Copy link
Contributor

marknet15 commented Mar 15, 2022

*_info can be linked to the non info counterparts on most occasions I think, so that shouldn't be too hard to cover

@alinabuzachis
Copy link
Contributor Author

@marknet15 Yes, exactly. At the moment, I didn't link them because the _info modules were not really used by the non info counterparts. I think we should have a couple of tasks using the _info module at least.

@markuman
Copy link
Member

markuman commented Apr 6, 2022

aws_sgw_info

this is a very hard one, because there is no module to create a storage gateway yet.

@markuman
Copy link
Member

markuman commented Apr 7, 2022

aws_sgw_info

this is a very hard one, because there is no module to create a storage gateway yet.

a few words more about the storage gateway (sgw).

To deploy a storage gateway, you'll need to deploy an EC2 instance with a special ami. easy.
Now it comes to the registration process. This is how we handle this.

- name: init sgw
  block:

    - name: get activation code
      uri:
        url: "http://{{ sgw_instance.instances[0].private_ip_address }}/?activationRegion={{ region }}"
        method: GET
        return_content: yes
      register: ACTICATION_TOKEN
      retries: 10
      delay: 30
      until: ACTICATION_TOKEN is not failed

    - name: register new sgw
      command: aws storagegateway activate-gateway \
        --activation-key {{ ACTICATION_TOKEN.url.split('activationKey=')[-1] }} \
        --gateway-name {{ sgw_name }} \
        --gateway-timezone GMT+1:00 \
        --gateway-region {{ region }} \
        --gateway-type FILE_S3

    - name: "list sgw: retries until gateway_operational_state is connected"
      aws_sgw_info:
        region: "{{ region }}"
        gather_file_shares: yes
        gather_local_disks: yes
        gather_tapes: no
        gather_volumes: no
      register: sgwfacts
      retries: 10
      delay: 30
      until: sgwfacts is not failed

After the instance has bootet, it took 1-3 minutes until you can curl the registration code. For this the node that runs the integration test must be

  • integrated in the VPC (in case of working with private ip)
  • or the EC2 instance needs a public IP where port 80 is available for the integration test node

To archive idempotent here, this block is only executed if the sgw isn't connected/available already

- name: list sgw
  aws_sgw_info:
    region: "{{ region }}"
    gather_file_shares: yes
    gather_local_disks: yes
    gather_tapes: no
    gather_volumes: no
  register: sgwfacts

- name: merge sgw names
  set_fact:
    sgws: "{{ sgwfacts.gateways |  map(attribute='gateway_name') | list }}"

- include_tasks: init_sgw.yml
  when: sgw_name not in sgws

So at the end, to test aws_sgw_info module, we'll need at least a sgw_activate_gateway (or some similar name, when it should also be used to delete the sgw) module, where this modules include also fetch of the registration code

- community.aws.sgw_activate_gateway:
    name: "{{ sgw_name }}"
    state: ['present','absent']
    ip: 1.2.3.4

...but it's also possible to glue everything with other modules together 😎

@tremble tremble changed the title List of modules without integration tests List of community modules without integration tests Jun 17, 2022
abikouo pushed a commit to abikouo/community.aws that referenced this issue Oct 24, 2023
new module: cloudwatch_metric_alarm_info

SUMMARY
Depends-On: ansible-collections#1066
Should be merged only after ansible-collections#1028 is merged.

Adding a new module for retrieving cloudwatch metric alarms info.

Currently supports following boto API(s)
describe_alarms()
ISSUE TYPE


New Module Pull Request

COMPONENT NAME

cloudwatch_metric_alarm_info
ADDITIONAL INFORMATION


Will be useful in moving these tasks from aws cli commands to amazon.aws module.
https://github.com/ansible-collections/community.aws/blob/main/tests/integration/targets/cloudwatch_metric_alarm/tasks/main.yml#L63-L70
ansible-collections#1440
The integration tests for this info module will be added to above tests, after the cloudwatch_metric_alarm module is migrated from community.aws to amazon.aws.

Sample playbook
---
- name: Create a metric alarm & get info
  hosts: localhost
  gather_facts: false
  tasks:
    - name: create alarm
      community.aws.cloudwatch_metric_alarm:
        state: present
        region: us-east-2
        name: "cpu-low-test-metric-alarm-1234"
        metric: "CPUUtilization"
        namespace: "AWS/EC2"
        statistic: Average
        comparison: "LessThanOrEqualToThreshold"
        threshold: 50.0
        period: 180
        evaluation_periods: 3
        unit: "Percent"
        description: "This will alarm when a instance's CPU usage average is lower than 50%"
        dimensions: {'InstanceId':'i-00a8b34xxxxxxxxxx'}

    - name: describe the metric alarm based on metric name and namespace
      amazon.aws.cloudwatch_metric_alarm_info:
        alarm_names:
          - cpu-low-test-metric-alarm-1234
      register: alarm_info

    - debug:
        var: alarm_info

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mandar Kulkarni <[email protected]>
Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
Reviewed-by: Gonéri Le Bouder <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request has_pr needs_triage
Projects
Development

No branches or pull requests

4 participants