~gabrielcocenza/juju-lint:bug/1965762-B

Last commit made on 2022-09-13
Get this branch:
git clone -b bug/1965762-B https://git.launchpad.net/~gabrielcocenza/juju-lint
Only Gabriel Cocenza can upload to this branch. If you are Gabriel Cocenza please log in for upload directions.

Branch merges

Branch information

Name:
bug/1965762-B
Repository:
lp:~gabrielcocenza/juju-lint

Recent commits

93659c4... by Gabriel Cocenza

added new rule for checking relations.

Closes-Bug: #1965762, #1975548

03479fa... by Gabriel Cocenza

unit tests to check if rules file on contrib folder load correctly.

- fixed broken rules

Closes-Bug: #1979542

Reviewed-on: https://code.launchpad.net/~gabrielcocenza/juju-lint/+git/juju-lint/+merge/429452
Reviewed-by: Eric Chen <email address hidden>

7c358ca... by Gabriel Cocenza

unit tests to check if rules file on contrib folder load correctly.

- fixed broken rules

Closes-Bug: #1979542

832f001... by Mert Kirpici

Close LP #1979686

Reviewed-on: https://code.launchpad.net/~mertkirpici/juju-lint/+git/juju-lint/+merge/428809
Reviewed-by: Gabriel Angelo Sgarbi Cocenza <email address hidden>

55c3ce7... by Mert Kirpici

tests/functional: run black

Signed-off-by: Mert Kırpıcı <email address hidden>

66a3e76... by Mert Kirpici

tests/functional: fix audit_local_cloud test

The command line argument "-t test" was mistakenly being passed to
juju-lint. Revert it.

Signed-off-by: Mert Kırpıcı <email address hidden>

8df1336... by Mert Kirpici

tests: make fcb bundle file a common test resource

Signed-off-by: Mert Kırpıcı <email address hidden>

b9c3815... by Mert Kirpici

tests/functional: add tox envs func-smoke func-dev

Also add info about the current state of the functional testing
infrastructure to CONTRIBUTING.md document.

Signed-off-by: Mert Kırpıcı <email address hidden>

6030a4c... by Mert Kirpici

tests/functional: fix install_fixture path assert

Different tox testenvs will have different names after .tox/ therefore
we are asserting the beginning of `juju-lint`'s path now.

Also fixtures that don't need cleanup return rather than yield now.

Signed-off-by: Mert Kırpıcı <email address hidden>

2b7637b... by Mert Kirpici

tests: add functional test coverage

Since the functional tests require the juju-lint application to be
installed to the system, there are two modes of running the tests:
installing the python package to the .tox environment or installing the
snap directly into the system and removing it afterwards. It is worth
mentioning that since `snap install` requires elevated privileges, in
the snap installation case, the pytest fixture install_package() that is
responsible for installing the package will call `sudo install...` and
`sudo remove ...` __requiring passwordless sudo access for the current
user__. The reason for this behaviour rather than enforcing an EUID of
zero is due to the fact that we need access to the user's juju
environment, not root's. Here are examples of both use cases.

Installing the python package:

  $ make functional

Installing the snap:

  $ JUJULINT_TEST_SNAP=./juju-lint_1.0.3_amd64.snap make functional

note the environment variable here. Also note that when the tests are
running against the python package, a WARNING level log will be printed
during the test run to indicate this fact, however when the snap package
is installed, there will be no WARNING printed.

Currently tests are divided into two cases and accompanying markers to
be able to run a subset of them. This might especially come in handy for
skipping the cloud tests during a development cycle since they involve
spinning up a model, deploying an application and destruction of the
model each time the tests are run.

Here is a summary of the two test cases.

- smoke
  - post-build tests as well as tests running against the
    fcb-yoga-focal-bundle.yaml file generated using the
    fcb/sku/stable-yoga-focal branch of the fce-templates repository
- cloud
  - tests that are running against a live model deployed on the local
    cloud via pytest-operator

Combined with the FUNC_ARGS environment variable, these markers could be
used to select tests. Here is an example that runs only the smoke tests:

  $ FUNC_ARGS="-m smoke" make functional

Here is another example utilizing exclusion, since the number of cases
might increase in the future:

  $ FUNC_ARGS="-m 'not cloud'" make functional

Closes-bug: #1979686
Signed-off-by: Mert Kırpıcı <email address hidden>