-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add support for static linters #200
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
from __future__ import print_function | ||
|
||
import os | ||
from avocado import Test | ||
from moduleframework import module_framework | ||
from moduleframework import dockerlinter | ||
|
||
class DockerInstructionsTests(module_framework.AvocadoTest): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace by inherited from |
||
""" | ||
:avocado: enable | ||
:avocado: tags=sanity,rhel,fedora,docker,docker_instruction_test,static | ||
|
||
""" | ||
|
||
dp = None | ||
|
||
def setUp(self): | ||
# it is not intended just for docker, but just docker packages are | ||
# actually properly signed | ||
self.dp = dockerlinter.DockerfileLinter() | ||
if self.dp.dockerfile is None: | ||
self.skip("Dockerfile was not found") | ||
|
||
def test_from_is_first_directive(self): | ||
self.assertTrue(self.dp.check_from_is_first()) | ||
|
||
def test_from_directive_is_valid(self): | ||
self.assertTrue(self.dp.check_from_directive_is_valid()) | ||
|
||
def test_chained_run_dnf_commands(self): | ||
self.assertTrue(self.dp.check_chained_run_dnf_commands()) | ||
|
||
def test_chained_run_rest_commands(self): | ||
self.assertTrue(self.dp.check_chained_run_rest_commands()) | ||
|
||
def test_helpmd_is_present(self): | ||
self.assert_to_warn(self.assertTrue, self.dp.check_helpmd_is_present()) | ||
|
||
|
||
class DockerLabelsTests(DockerInstructionsTests): | ||
""" | ||
:avocado: enable | ||
:avocado: tags=sanity,rhel,fedora,docker,docker_labels_test | ||
|
||
""" | ||
|
||
def _test_for_env_and_label(self, docker_env, docker_label, env=True): | ||
label_found = True | ||
if env: | ||
label = self.dp.get_docker_specific_env(docker_env) | ||
else: | ||
label = self.dp.get_specific_label(docker_env) | ||
if not label: | ||
label_found = self.dp.get_specific_label(docker_label) | ||
return label_found | ||
|
||
def test_architecture_in_env_and_label_exists(self): | ||
self.assertTrue(self.dp.get_specific_label("architecture")) | ||
|
||
def test_name_in_env_and_label_exists(self): | ||
self.assertTrue(self.dp.get_docker_specific_env("NAME=")) | ||
self.assertTrue(self.dp.get_specific_label("name")) | ||
|
||
def test_maintainer_label_exists(self): | ||
self.assertTrue(self.dp.get_specific_label("maintainer")) | ||
|
||
def test_release_label_exists(self): | ||
self.assertTrue(self.dp.get_specific_label("release")) | ||
|
||
def test_version_label_exists(self): | ||
self.assertTrue(self.dp.get_specific_label("version")) | ||
|
||
def test_com_redhat_component_label_exists(self): | ||
self.assertTrue(self.dp.get_specific_label("com.redhat.component")) | ||
|
||
def test_summary_label_exists(self): | ||
self.assertTrue(self.dp.get_specific_label("summary")) | ||
|
||
def test_run_or_usage_label_exists(self): | ||
self.assertTrue(self._test_for_env_and_label("run", "usage", env=False)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ def get_dir(system_path=None, virtual_path=None): | |
|
||
data_files = {} | ||
|
||
paths = ['docs', 'examples', 'tools'] | ||
paths = ['docs', 'examples', 'tests'] | ||
|
||
for path in paths: | ||
for root, dirs, files in os.walk(path, followlinks=True): | ||
|
@@ -77,7 +77,7 @@ def get_dir(system_path=None, virtual_path=None): | |
author_email='[email protected]', | ||
url='https://github.com/fedora-modularity/meta-test-family', | ||
license='GPLv2+', | ||
packages=find_packages(exclude=['docs', 'examples', 'tools']), | ||
packages=find_packages(exclude=['docs', 'examples', 'tests']), | ||
include_package_data=True, | ||
data_files=data_files.items(), | ||
scripts=[], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line and remove
module_framework.AvocadoTest
from class parentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not possible, because we have in
AvocadoTest
functionassert_to_warn
.