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

[TODO] improve coverage of unit tests #325

Closed
6 tasks
ITProKyle opened this issue May 19, 2020 · 2 comments
Closed
6 tasks

[TODO] improve coverage of unit tests #325

ITProKyle opened this issue May 19, 2020 · 2 comments
Labels
maintenance General repo or CI/CD upkeep priority:high High priority issue or pull request

Comments

@ITProKyle
Copy link
Collaborator

NOTE: Some aspects overlap with other issues that revolve around refactoring and simplifying code. This issue may need to be broken up into smaller issues similar to this but for now, this can act as a single tracking point.

Acceptance Criteria

  • above 90% coverage
  • should be pytest tests
  • test should factor in all current and past config structures that are still supported (within reason)
  • refactor as needed to make things easier to test (e.g. split into smaller functions/methods)
  • rewrite old tests to improve performance, structure, and coverage (e.g. aws_lambda hook tests are very slow)
  • consolidate fixtures, factories, mocks, patches, etc using pytest fixtures
@ITProKyle ITProKyle added priority:high High priority issue or pull request maintenance General repo or CI/CD upkeep labels May 19, 2020
@ITProKyle
Copy link
Collaborator Author

Current coverage report
Name                                                                      Stmts   Miss  Cover
---------------------------------------------------------------------------------------------
runway/__init__.py                                                           11      3    73%
runway/blueprints/k8s/k8s_iam.py                                             21     21     0%
runway/blueprints/k8s/k8s_master.py                                          25     25     0%
runway/blueprints/k8s/k8s_workers.py                                         38     38     0%
runway/blueprints/staticsite/auth_at_edge.py                                 65     65     0%
runway/blueprints/staticsite/cleanup.py                                      55     55     0%
runway/blueprints/staticsite/dependencies.py                                 29     29     0%
runway/blueprints/staticsite/staticsite.py                                  118    118     0%
runway/blueprints/tf_state.py                                                24     24     0%
runway/cfngin/__init__.py                                                     3      0   100%
runway/cfngin/actions/base.py                                                86     28    67%
runway/cfngin/actions/build.py                                              235     55    77%
runway/cfngin/actions/destroy.py                                             55      8    85%
runway/cfngin/actions/diff.py                                               109     37    66%
runway/cfngin/actions/graph.py                                               39     25    36%
runway/cfngin/actions/info.py                                                20     14    30%
runway/cfngin/awscli_yamlhelper.py                                           26      3    88%
runway/cfngin/blueprints/base.py                                            215     14    93%
runway/cfngin/blueprints/raw.py                                              78      9    88%
runway/cfngin/blueprints/testutil.py                                         64     35    45%
runway/cfngin/blueprints/variables/types.py                                  79      2    97%
runway/cfngin/cfngin.py                                                     131      4    97%
runway/cfngin/commands/__init__.py                                            1      0   100%
runway/cfngin/commands/stacker/__init__.py                                   31      1    97%
runway/cfngin/commands/stacker/base.py                                       86     15    83%
runway/cfngin/commands/stacker/build.py                                      19      3    84%
runway/cfngin/commands/stacker/destroy.py                                    17      4    76%
runway/cfngin/commands/stacker/diff.py                                       15      4    73%
runway/cfngin/commands/stacker/graph.py                                      13      3    77%
runway/cfngin/commands/stacker/info.py                                       14      4    71%
runway/cfngin/config/__init__.py                                            232     18    92%
runway/cfngin/config/translators/__init__.py                                  3      0   100%
runway/cfngin/config/translators/kms.py                                       4      2    50%
runway/cfngin/context.py                                                    199     11    94%
runway/cfngin/dag/__init__.py                                               210     20    90%
runway/cfngin/environment.py                                                 14      0   100%
runway/cfngin/exceptions.py                                                 175     12    93%
runway/cfngin/hooks/acm.py                                                  151      0   100%
runway/cfngin/hooks/aws_lambda.py                                           269     30    89%
runway/cfngin/hooks/base.py                                                 100      0   100%
runway/cfngin/hooks/command.py                                               37      4    89%
runway/cfngin/hooks/ecs.py                                                   19      0   100%
runway/cfngin/hooks/iam.py                                                   74     49    34%
runway/cfngin/hooks/keypair.py                                              114      6    95%
runway/cfngin/hooks/route53.py                                               13     13     0%
runway/cfngin/hooks/utils.py                                                 68      7    90%
runway/cfngin/logger/__init__.py                                             28     19    32%
runway/cfngin/lookups/__init__.py                                             1      0   100%
runway/cfngin/lookups/handlers/ami.py                                        45      5    89%
runway/cfngin/lookups/handlers/default.py                                    12      0   100%
runway/cfngin/lookups/handlers/dynamodb.py                                   86      3    97%
runway/cfngin/lookups/handlers/envvar.py                                     12      0   100%
runway/cfngin/lookups/handlers/file.py                                       56      8    86%
runway/cfngin/lookups/handlers/hook_data.py                                  30      0   100%
runway/cfngin/lookups/handlers/kms.py                                        16      0   100%
runway/cfngin/lookups/handlers/output.py                                     30      5    83%
runway/cfngin/lookups/handlers/rxref.py                                      14      2    86%
runway/cfngin/lookups/handlers/split.py                                      10      0   100%
runway/cfngin/lookups/handlers/ssmstore.py                                   22      0   100%
runway/cfngin/lookups/handlers/xref.py                                       12      1    92%
runway/cfngin/lookups/registry.py                                            46     11    76%
runway/cfngin/plan.py                                                       263     24    91%
runway/cfngin/providers/aws/default.py                                      517     90    83%
runway/cfngin/providers/base.py                                              24      9    62%
runway/cfngin/session_cache.py                                               23      1    96%
runway/cfngin/stack.py                                                       77     14    82%
runway/cfngin/status.py                                                      53      3    94%
runway/cfngin/target.py                                                       6      4    33%
runway/cfngin/tokenize_userdata.py                                           17      0   100%
runway/cfngin/ui.py                                                          30      5    83%
runway/cfngin/util.py                                                       340    143    58%
runway/cli.py                                                                27     27     0%
runway/commands/__init__.py                                                  17      0   100%
runway/commands/base_command.py                                              33     13    61%
runway/commands/command_loader.py                                            13     13     0%
runway/commands/modules/__init__.py                                           6      0   100%
runway/commands/modules/deploy.py                                             4      1    75%
runway/commands/modules/destroy.py                                            4      1    75%
runway/commands/modules/dismantle.py                                          2      0   100%
runway/commands/modules/plan.py                                               4      1    75%
runway/commands/modules/takeoff.py                                            2      0   100%
runway/commands/modules/taxi.py                                               2      0   100%
runway/commands/modules_command.py                                          340    217    36%
runway/commands/runway/__init__.py                                           11      0   100%
runway/commands/runway/envvars.py                                            33     19    42%
runway/commands/runway/gen_sample.py                                        189    161    15%
runway/commands/runway/init.py                                               14      7    50%
runway/commands/runway/kbenv.py                                              16      8    50%
runway/commands/runway/preflight.py                                           2      0   100%
runway/commands/runway/run_aws.py                                            24     15    38%
runway/commands/runway/run_python.py                                         14      6    57%
runway/commands/runway/run_stacker.py                                        19      8    58%
runway/commands/runway/test.py                                               46     35    24%
runway/commands/runway/tfenv.py                                              16      8    50%
runway/commands/runway/whichenv.py                                            7      2    71%
runway/commands/runway_command.py                                            70     17    76%
runway/config.py                                                            279     84    70%
runway/context.py                                                           109     20    82%
runway/env_mgr/__init__.py                                                   38     29    24%
runway/env_mgr/kbenv.py                                                      63     46    27%
runway/env_mgr/tfenv.py                                                     115     88    23%
runway/hooks/cleanup_s3.py                                                   41     41     0%
runway/hooks/cleanup_ssm.py                                                  14     14     0%
runway/hooks/staticsite/auth_at_edge/callback_url_retriever.py               26     26     0%
runway/hooks/staticsite/auth_at_edge/client_updater.py                       19     19     0%
runway/hooks/staticsite/auth_at_edge/domain_updater.py                       46     46     0%
runway/hooks/staticsite/auth_at_edge/lambda_config.py                        34     34     0%
runway/hooks/staticsite/auth_at_edge/templates/check_auth/__init__.py        79     79     0%
runway/hooks/staticsite/auth_at_edge/templates/http_headers/__init__.py       8      8     0%
runway/hooks/staticsite/auth_at_edge/templates/parse_auth/__init__.py        48     48     0%
runway/hooks/staticsite/auth_at_edge/templates/refresh_auth/__init__.py      49     49     0%
runway/hooks/staticsite/auth_at_edge/templates/shared.py                    122    122     0%
runway/hooks/staticsite/auth_at_edge/templates/sign_out/__init__.py          16     16     0%
runway/hooks/staticsite/auth_at_edge/user_pool_id_retriever.py               12     12     0%
runway/hooks/staticsite/build_staticsite.py                                  67     67     0%
runway/hooks/staticsite/cleanup.py                                           17     17     0%
runway/hooks/staticsite/upload_staticsite.py                                 60     60     0%
runway/hooks/staticsite/util.py                                              43     34    21%
runway/lookups/handlers/__init__.py                                           3      0   100%
runway/lookups/handlers/base.py                                              89      4    96%
runway/lookups/handlers/env.py                                               10      0   100%
runway/lookups/handlers/ssm.py                                               18      0   100%
runway/lookups/handlers/var.py                                               13      0   100%
runway/lookups/registry.py                                                   16      2    88%
runway/module/__init__.py                                                   130     42    68%
runway/module/cdk.py                                                         64     64     0%
runway/module/cloudformation.py                                              14      0   100%
runway/module/k8s.py                                                         72     72     0%
runway/module/serverless.py                                                 192     40    79%
runway/module/staticsite.py                                                 189    189     0%
runway/module/terraform.py                                                  194     88    55%
runway/path.py                                                               62      2    97%
runway/runway_module_type.py                                                 54     36    33%
runway/s3_util.py                                                           100     79    21%
runway/sources/git.py                                                        71      8    89%
runway/sources/source.py                                                     19      1    95%
runway/tests/handlers/__init__.py                                             3      0   100%
runway/tests/handlers/base.py                                                10      5    50%
runway/tests/handlers/cfn_lint.py                                            27     14    48%
runway/tests/handlers/script.py                                              21     11    48%
runway/tests/handlers/yaml_lint.py                                           28     15    46%
runway/tests/registry.py                                                     16      2    88%
runway/util.py                                                              272    118    57%
runway/variables.py                                                         251     34    86%
---------------------------------------------------------------------------------------------
TOTAL                                                                      9332   3509    62%

@ITProKyle
Copy link
Collaborator Author

I am going to close this out as this has been an ongoing effort throughout all new development. Runway is now at 80% coverage with just unit tests and 85% when including integration tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance General repo or CI/CD upkeep priority:high High priority issue or pull request
Projects
None yet
Development

No branches or pull requests

1 participant