Skip to content

Commit

Permalink
Update ansible-lint and version and e2e-tests to support changes the …
Browse files Browse the repository at this point in the history
…changes (ansible#643)

* update tests to support changes for ansible-lint

* make yaml parsing exception less verbose

* add feature to display ansible-lint version before running e2e tests

* update pip packages for test-setup

* update test to support ansible-lint version 6.8.0b3
  • Loading branch information
priyamsahoo authored Oct 6, 2022
1 parent 347055b commit 7056e80
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .config/requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ansible-core>=2.13
ansible-lint>=6.2.2
ansible-lint>=6.8.0.dev0
mypy # used by vscode
pip-tools>=6.6.2
pre-commit>=2.19
4 changes: 2 additions & 2 deletions .config/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ansible-compat==2.2.1
ansible-core==2.13.4
ansible-lint==6.3.0
ansible-lint==6.8.0b3
attrs==21.4.0
bracex==2.3.post1
cffi==1.15.0
Expand All @@ -14,7 +14,7 @@ filelock==3.7.1
identify==2.5.1
iniconfig==1.1.1
jinja2==3.1.2
jsonschema==4.6.0
jsonschema==4.16.0
markupsafe==2.1.1
mypy==0.961
mypy-extensions==0.4.3
Expand Down
2 changes: 1 addition & 1 deletion src/features/utils/applyFileInspectionForKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ export async function applyFileInspectionForKeywords(
}
}
} catch (err) {
console.error(err);
console.error("Error loading yaml file");
}
}
2 changes: 1 addition & 1 deletion test/testFixtures/diagnostics/ansible/without_ee/1.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name: play name
- name: Play name
hosts: localhost
tasks:
- ansible.builtin.debug:
11 changes: 11 additions & 0 deletions test/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ export const ANSIBLE_COLLECTIONS_FIXTURES_BASE_PATH = path.resolve(
"common",
"collections"
);
const PRETEST_ERR_RC = 2;

// display ansible-lint version and exit testing if ansible-lint is absent
const command = "ansible-lint --version";
try {
const result = cp.execSync(command);
console.info(`Detected: ${result}`);
} catch (e) {
console.error(`error: test requisites not met, '${command}' returned ${e}`);
process.exit(PRETEST_ERR_RC);
}

async function main(): Promise<void> {
try {
Expand Down
3 changes: 2 additions & 1 deletion test/testScripts/diagnostics/testAnsibleWithoutEE.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export function testDiagnosticsAnsibleWithoutEE(): void {
await testDiagnostics(docUri2, [
{
severity: 0,
message: "Ansible syntax check failed",
message:
"Unexpected error code 4 from execution of: ansible-playbook --syntax-check",
range: new vscode.Range(
new vscode.Position(0, 0),
new vscode.Position(0, integer.MAX_VALUE)
Expand Down
2 changes: 1 addition & 1 deletion test/testScripts/diagnostics/testYamlWithoutEE.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function testDiagnosticsYAMLWithoutEE(): void {
await testDiagnostics(docUri1, [
{
severity: 0,
message: "Ansible syntax check failed",
message: "Failed to load YAML file",
range: new vscode.Range(
new vscode.Position(0, 0),
new vscode.Position(0, integer.MAX_VALUE)
Expand Down
2 changes: 1 addition & 1 deletion tools/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fi
python3 -m pip install -q -U pip

if [[ $(uname || true) != MINGW* ]]; then # if we are not on pure Windows
python3 -m pip install -q \
python3 -m pip install \
-c .config/requirements.txt -r .config/requirements.in
fi

Expand Down

0 comments on commit 7056e80

Please sign in to comment.