summaryrefslogtreecommitdiffstats
path: root/test/schemas/negative_test/roles
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:06:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:06:49 +0000
commit2fe34b6444502079dc0b84365ce82dbc92de308e (patch)
tree8fedcab52bbbc3db6c5aa909a88a7a7b81685018 /test/schemas/negative_test/roles
parentInitial commit. (diff)
downloadansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.tar.xz
ansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.zip
Adding upstream version 6.17.2.upstream/6.17.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--test/schemas/negative_test/roles/meta/argument_specs.yml5
-rw-r--r--test/schemas/negative_test/roles/meta/argument_specs.yml.md34
-rw-r--r--test/schemas/negative_test/roles/meta/main.yml10
-rw-r--r--test/schemas/negative_test/roles/meta/main.yml.md58
-rw-r--r--test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml10
-rw-r--r--test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml.md34
-rw-r--r--test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml11
-rw-r--r--test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml.md34
-rw-r--r--test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml12
-rw-r--r--test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml.md58
-rw-r--r--test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml13
-rw-r--r--test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml.md101
12 files changed, 380 insertions, 0 deletions
diff --git a/test/schemas/negative_test/roles/meta/argument_specs.yml b/test/schemas/negative_test/roles/meta/argument_specs.yml
new file mode 100644
index 0000000..ddc9862
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta/argument_specs.yml
@@ -0,0 +1,5 @@
+---
+argument_specs:
+ main:
+ foo: bar # <-- invalid based on json schema
+ options: {}
diff --git a/test/schemas/negative_test/roles/meta/argument_specs.yml.md b/test/schemas/negative_test/roles/meta/argument_specs.yml.md
new file mode 100644
index 0000000..34da932
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta/argument_specs.yml.md
@@ -0,0 +1,34 @@
+# ajv errors
+
+```json
+[
+ {
+ "instancePath": "/argument_specs/main",
+ "keyword": "additionalProperties",
+ "message": "must NOT have additional properties",
+ "params": {
+ "additionalProperty": "foo"
+ },
+ "schemaPath": "#/additionalProperties"
+ }
+]
+```
+
+# check-jsonschema
+
+stdout:
+
+```json
+{
+ "status": "fail",
+ "errors": [
+ {
+ "filename": "negative_test/roles/meta/argument_specs.yml",
+ "path": "$.argument_specs.main",
+ "message": "Additional properties are not allowed ('foo' was unexpected)",
+ "has_sub_errors": false
+ }
+ ],
+ "parse_errors": []
+}
+```
diff --git a/test/schemas/negative_test/roles/meta/main.yml b/test/schemas/negative_test/roles/meta/main.yml
new file mode 100644
index 0000000..3ed9a8c
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta/main.yml
@@ -0,0 +1,10 @@
+galaxy_info:
+ description: bar
+ min_ansible_version: "2.9"
+ company: foo
+ license: MIT
+ galaxy_tags: database # <-- invalid, must be a list of strings
+ platforms:
+ - name: Alpine
+ versions:
+ - all
diff --git a/test/schemas/negative_test/roles/meta/main.yml.md b/test/schemas/negative_test/roles/meta/main.yml.md
new file mode 100644
index 0000000..2c9e99b
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta/main.yml.md
@@ -0,0 +1,58 @@
+# ajv errors
+
+```json
+[
+ {
+ "instancePath": "/galaxy_info",
+ "keyword": "required",
+ "message": "must have required property 'author'",
+ "params": {
+ "missingProperty": "author"
+ },
+ "schemaPath": "#/allOf/0/then/required"
+ },
+ {
+ "instancePath": "/galaxy_info",
+ "keyword": "if",
+ "message": "must match \"then\" schema",
+ "params": {
+ "failingKeyword": "then"
+ },
+ "schemaPath": "#/allOf/0/if"
+ },
+ {
+ "instancePath": "/galaxy_info/galaxy_tags",
+ "keyword": "type",
+ "message": "must be array",
+ "params": {
+ "type": "array"
+ },
+ "schemaPath": "#/properties/galaxy_tags/type"
+ }
+]
+```
+
+# check-jsonschema
+
+stdout:
+
+```json
+{
+ "status": "fail",
+ "errors": [
+ {
+ "filename": "negative_test/roles/meta/main.yml",
+ "path": "$.galaxy_info",
+ "message": "'author' is a required property",
+ "has_sub_errors": false
+ },
+ {
+ "filename": "negative_test/roles/meta/main.yml",
+ "path": "$.galaxy_info.galaxy_tags",
+ "message": "'database' is not of type 'array'",
+ "has_sub_errors": false
+ }
+ ],
+ "parse_errors": []
+}
+```
diff --git a/test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml b/test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml
new file mode 100644
index 0000000..1fa41eb
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml
@@ -0,0 +1,10 @@
+collections:
+ - foo # invalid pattern
+galaxy_info:
+ standalone: false # role inside a collection
+ description: foo
+ license: bar
+ platforms:
+ - name: Fedora
+ versions:
+ - all
diff --git a/test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml.md b/test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml.md
new file mode 100644
index 0000000..1b8dcd0
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta_invalid_collection/meta/main.yml.md
@@ -0,0 +1,34 @@
+# ajv errors
+
+```json
+[
+ {
+ "instancePath": "/collections/0",
+ "keyword": "pattern",
+ "message": "must match pattern \"^[a-z_]+\\.[a-z_]+$\"",
+ "params": {
+ "pattern": "^[a-z_]+\\.[a-z_]+$"
+ },
+ "schemaPath": "#/$defs/collections/items/pattern"
+ }
+]
+```
+
+# check-jsonschema
+
+stdout:
+
+```json
+{
+ "status": "fail",
+ "errors": [
+ {
+ "filename": "negative_test/roles/meta_invalid_collection/meta/main.yml",
+ "path": "$.collections[0]",
+ "message": "'foo' does not match '^[a-z_]+\\\\.[a-z_]+$'",
+ "has_sub_errors": false
+ }
+ ],
+ "parse_errors": []
+}
+```
diff --git a/test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml b/test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml
new file mode 100644
index 0000000..488928c
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml
@@ -0,0 +1,11 @@
+# role inside a collection
+collections:
+ - FOO.BAR # invalid pattern, need to use lowercase
+galaxy_info:
+ standalone: false
+ description: foo
+ license: bar
+ platforms:
+ - name: Fedora
+ versions:
+ - all
diff --git a/test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml.md b/test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml.md
new file mode 100644
index 0000000..5d775f0
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta_invalid_collections/meta/main.yml.md
@@ -0,0 +1,34 @@
+# ajv errors
+
+```json
+[
+ {
+ "instancePath": "/collections/0",
+ "keyword": "pattern",
+ "message": "must match pattern \"^[a-z_]+\\.[a-z_]+$\"",
+ "params": {
+ "pattern": "^[a-z_]+\\.[a-z_]+$"
+ },
+ "schemaPath": "#/$defs/collections/items/pattern"
+ }
+]
+```
+
+# check-jsonschema
+
+stdout:
+
+```json
+{
+ "status": "fail",
+ "errors": [
+ {
+ "filename": "negative_test/roles/meta_invalid_collections/meta/main.yml",
+ "path": "$.collections[0]",
+ "message": "'FOO.BAR' does not match '^[a-z_]+\\\\.[a-z_]+$'",
+ "has_sub_errors": false
+ }
+ ],
+ "parse_errors": []
+}
+```
diff --git a/test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml b/test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml
new file mode 100644
index 0000000..e50e5b7
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml
@@ -0,0 +1,12 @@
+---
+# old standalone role
+galaxy_info:
+ description: foo
+ min_ansible_version: "2.9"
+ namespace: foo-bar
+ company: foo
+ license: MIT
+ platforms:
+ - name: Alpine
+ versions:
+ - all
diff --git a/test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml.md b/test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml.md
new file mode 100644
index 0000000..ad7e9d3
--- /dev/null
+++ b/test/schemas/negative_test/roles/meta_invalid_role_namespace/meta/main.yml.md
@@ -0,0 +1,58 @@
+# ajv errors
+
+```json
+[
+ {
+ "instancePath": "/galaxy_info",
+ "keyword": "required",
+ "message": "must have required property 'author'",
+ "params": {
+ "missingProperty": "author"
+ },
+ "schemaPath": "#/allOf/0/then/required"
+ },
+ {
+ "instancePath": "/galaxy_info",
+ "keyword": "if",
+ "message": "must match \"then\" schema",
+ "params": {
+ "failingKeyword": "then"
+ },
+ "schemaPath": "#/allOf/0/if"
+ },
+ {
+ "instancePath": "/galaxy_info/namespace",
+ "keyword": "pattern",
+ "message": "must match pattern \"^[a-z][a-z0-9_]+$\"",
+ "params": {
+ "pattern": "^[a-z][a-z0-9_]+$"
+ },
+ "schemaPath": "#/properties/namespace/pattern"
+ }
+]
+```
+
+# check-jsonschema
+
+stdout:
+
+```json
+{
+ "status": "fail",
+ "errors": [
+ {
+ "filename": "negative_test/roles/meta_invalid_role_namespace/meta/main.yml",
+ "path": "$.galaxy_info",
+ "message": "'author' is a required property",
+ "has_sub_errors": false
+ },
+ {
+ "filename": "negative_test/roles/meta_invalid_role_namespace/meta/main.yml",
+ "path": "$.galaxy_info.namespace",
+ "message": "'foo-bar' does not match '^[a-z][a-z0-9_]+$'",
+ "has_sub_errors": false
+ }
+ ],
+ "parse_errors": []
+}
+```
diff --git a/test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml b/test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml
new file mode 100644
index 0000000..81d4d3d
--- /dev/null
+++ b/test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml
@@ -0,0 +1,13 @@
+# old standalone role
+galaxy_info:
+ description: bar
+ min_ansible_version: "2.9"
+ company: foo
+ license: MIT
+ platforms:
+ - name: Alpine
+ versions:
+ - all
+
+dependencies:
+ - version: foo # invalid, should have at least name, role or src properties
diff --git a/test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml.md b/test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml.md
new file mode 100644
index 0000000..f09b1ac
--- /dev/null
+++ b/test/schemas/negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml.md
@@ -0,0 +1,101 @@
+# ajv errors
+
+```json
+[
+ {
+ "instancePath": "/dependencies/0",
+ "keyword": "required",
+ "message": "must have required property 'role'",
+ "params": {
+ "missingProperty": "role"
+ },
+ "schemaPath": "#/anyOf/0/required"
+ },
+ {
+ "instancePath": "/dependencies/0",
+ "keyword": "required",
+ "message": "must have required property 'src'",
+ "params": {
+ "missingProperty": "src"
+ },
+ "schemaPath": "#/anyOf/1/required"
+ },
+ {
+ "instancePath": "/dependencies/0",
+ "keyword": "required",
+ "message": "must have required property 'name'",
+ "params": {
+ "missingProperty": "name"
+ },
+ "schemaPath": "#/anyOf/2/required"
+ },
+ {
+ "instancePath": "/dependencies/0",
+ "keyword": "anyOf",
+ "message": "must match a schema in anyOf",
+ "params": {},
+ "schemaPath": "#/anyOf"
+ },
+ {
+ "instancePath": "/galaxy_info",
+ "keyword": "required",
+ "message": "must have required property 'author'",
+ "params": {
+ "missingProperty": "author"
+ },
+ "schemaPath": "#/allOf/0/then/required"
+ },
+ {
+ "instancePath": "/galaxy_info",
+ "keyword": "if",
+ "message": "must match \"then\" schema",
+ "params": {
+ "failingKeyword": "then"
+ },
+ "schemaPath": "#/allOf/0/if"
+ }
+]
+```
+
+# check-jsonschema
+
+stdout:
+
+```json
+{
+ "status": "fail",
+ "errors": [
+ {
+ "filename": "negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml",
+ "path": "$.dependencies[0]",
+ "message": "{'version': 'foo'} is not valid under any of the given schemas",
+ "has_sub_errors": true,
+ "best_match": {
+ "path": "$.dependencies[0]",
+ "message": "'role' is a required property"
+ },
+ "sub_errors": [
+ {
+ "path": "$.dependencies[0]",
+ "message": "'role' is a required property"
+ },
+ {
+ "path": "$.dependencies[0]",
+ "message": "'src' is a required property"
+ },
+ {
+ "path": "$.dependencies[0]",
+ "message": "'name' is a required property"
+ }
+ ]
+ },
+ {
+ "filename": "negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml",
+ "path": "$.galaxy_info",
+ "message": "'author' is a required property",
+ "has_sub_errors": false
+ }
+ ],
+ "parse_errors": []
+}
+```