summaryrefslogtreecommitdiff
path: root/spec/frontend/editor
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-15 21:09:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-15 21:09:52 +0000
commita2fd863d3be23fee66ec7036b8febb2605c17767 (patch)
tree27eb2c778723397d6326c72cd13e953bf9cb2564 /spec/frontend/editor
parentefbd20fd1ecd091f1270f73d617822a32c94376f (diff)
downloadgitlab-ce-a2fd863d3be23fee66ec7036b8febb2605c17767.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/editor')
-rw-r--r--spec/frontend/editor/schema/ci/ci_schema_spec.js10
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml8
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml8
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml23
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml3
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml10
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml15
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml12
8 files changed, 41 insertions, 48 deletions
diff --git a/spec/frontend/editor/schema/ci/ci_schema_spec.js b/spec/frontend/editor/schema/ci/ci_schema_spec.js
index b9d2426c33d..c9010fbec0c 100644
--- a/spec/frontend/editor/schema/ci/ci_schema_spec.js
+++ b/spec/frontend/editor/schema/ci/ci_schema_spec.js
@@ -2,7 +2,7 @@ import Ajv from 'ajv';
import AjvFormats from 'ajv-formats';
import CiSchema from '~/editor/schema/ci.json';
-// JSON POSITIVE TESTS
+// JSON POSITIVE TESTS (LEGACY)
import AllowFailureJson from './json_tests/positive_tests/allow_failure.json';
import EnvironmentJson from './json_tests/positive_tests/environment.json';
import GitlabCiDependenciesJson from './json_tests/positive_tests/gitlab-ci-dependencies.json';
@@ -14,7 +14,7 @@ import TerraformReportJson from './json_tests/positive_tests/terraform_report.js
import VariablesMixStringAndUserInputJson from './json_tests/positive_tests/variables_mix_string_and_user_input.json';
import VariablesJson from './json_tests/positive_tests/variables.json';
-// JSON NEGATIVE TESTS
+// JSON NEGATIVE TESTS (LEGACY)
import DefaultNoAdditionalPropertiesJson from './json_tests/negative_tests/default_no_additional_properties.json';
import InheritDefaultNoAdditionalPropertiesJson from './json_tests/negative_tests/inherit_default_no_additional_properties.json';
import JobVariablesMustNotContainObjectsJson from './json_tests/negative_tests/job_variables_must_not_contain_objects.json';
@@ -34,6 +34,7 @@ import RulesYaml from './yaml_tests/positive_tests/rules.yml';
import ArtifactsNegativeYaml from './yaml_tests/negative_tests/artifacts.yml';
import CacheNegativeYaml from './yaml_tests/negative_tests/cache.yml';
import IncludeNegativeYaml from './yaml_tests/negative_tests/include.yml';
+import RulesNegativeYaml from './yaml_tests/negative_tests/rules.yml';
const ajv = new Ajv({
strictTypes: false,
@@ -61,11 +62,11 @@ describe('positive tests', () => {
VariablesJson,
// YAML
+ ArtifactsYaml,
CacheYaml,
FilterYaml,
IncludeYaml,
RulesYaml,
- ArtifactsYaml,
}),
)('schema validates %s', (_, input) => {
expect(input).toValidateJsonSchema(schema);
@@ -85,9 +86,10 @@ describe('negative tests', () => {
RetryUnknownWhenJson,
// YAML
+ ArtifactsNegativeYaml,
CacheNegativeYaml,
IncludeNegativeYaml,
- ArtifactsNegativeYaml,
+ RulesNegativeYaml,
}),
)('schema validates %s', (_, input) => {
expect(input).not.toValidateJsonSchema(schema);
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml
index ee533f54d3b..04020c06753 100644
--- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml
+++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/cache.yml
@@ -1,15 +1,13 @@
-# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779
stages:
- prepare
-# invalid cache:when value
-job1:
+# invalid cache:when values
+when no integer:
stage: prepare
cache:
when: 0
-# invalid cache:when value
-job2:
+when must be a reserved word:
stage: prepare
cache:
when: 'never'
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml
index 287150a765f..1e16bb55405 100644
--- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml
+++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/include.yml
@@ -1,16 +1,14 @@
-# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779
stages:
- prepare
-# missing file property
-childPipeline:
+# invalid trigger:include
+trigger missing file property:
stage: prepare
trigger:
include:
- project: 'my-group/my-pipeline-library'
-# missing project property
-childPipeline2:
+trigger missing project property:
stage: prepare
trigger:
include:
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml
index 76560b8e7ec..d74a681b23b 100644
--- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml
+++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules.yml
@@ -1,11 +1,14 @@
-# unnecessary ref declaration
-rules:
- - changes:
- paths:
- - README.md
- compare_to: { ref: 'main' }
+# invalid rules:changes
+unnecessary ref declaration:
+ script: exit 0
+ rules:
+ - changes:
+ paths:
+ - README.md
+ compare_to: { ref: 'main' }
-# wrong path declaration
-rules:
- - changes:
- paths: { file: 'DOCKER' }
+wrong path declaration:
+ script: exit 0
+ rules:
+ - changes:
+ paths: { file: 'DOCKER' }
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml
index 436c7d72699..d83e14fdc6a 100644
--- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml
+++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/cache.yml
@@ -1,8 +1,7 @@
-# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779
stages:
- prepare
-# test for cache:when values
+# valid cache:when values
job1:
stage: prepare
script:
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml
index 2b29c24fa3c..f82ea71dcf3 100644
--- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml
+++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/filter.yml
@@ -1,5 +1,5 @@
-# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79335
-deploy-template:
+# valid only/except values
+only and except as array of strings:
script:
- echo "hello world"
only:
@@ -7,12 +7,10 @@ deploy-template:
except:
- bar
-# null value allowed
-deploy-without-only:
+only as null value:
extends: deploy-template
only:
-# null value allowed
-deploy-without-except:
+except as null value:
extends: deploy-template
except:
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml
index 3497be28058..c00ab0d464a 100644
--- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml
+++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/include.yml
@@ -1,17 +1,15 @@
-# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70779
+stages:
+ - prepare
-# test for include:rules
+# valid include:rules
include:
- local: builds.yml
rules:
- if: '$INCLUDE_BUILDS == "true"'
when: always
-stages:
- - prepare
-
-# test for trigger:include
-childPipeline:
+# valid trigger:include
+trigger:include accepts project and file properties:
stage: prepare
script:
- echo 'creating pipeline...'
@@ -20,8 +18,7 @@ childPipeline:
- project: 'my-group/my-pipeline-library'
file: '.gitlab-ci.yml'
-# accepts optional ref property
-childPipeline2:
+trigger:include accepts optional ref property:
stage: prepare
script:
- echo 'creating pipeline...'
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml
index b8d9a55e862..37cae6b4264 100644
--- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml
+++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules.yml
@@ -1,9 +1,5 @@
-# tests for:
-# workflow:rules:changes
-# workflow:rules:exists
-# rules:changes:path
-
-job_name1:
+# valid workflow:rules:changes
+rules:changes with paths and compare_to properties:
script: exit 0
rules:
- changes:
@@ -11,12 +7,14 @@ job_name1:
- README.md
compare_to: main
-job_name2:
+rules:changes as array of strings:
script: exit 0
rules:
- changes:
- README.md
+# valid workflow:rules:exists
+# valid rules:changes:path
workflow:
rules:
- changes: