diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-11 15:10:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-11 15:10:03 +0000 |
commit | 14ae125e1c59ca3e9b535938707831c986dbbc43 (patch) | |
tree | 6cb2244b7aafe63586d5e1c538ab8e1385db4163 /spec/frontend/editor | |
parent | fd31bd1fc7954f69025d8e6bbe7f772ea9fb4bb0 (diff) | |
download | gitlab-ce-14ae125e1c59ca3e9b535938707831c986dbbc43.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/editor')
22 files changed, 209 insertions, 0 deletions
diff --git a/spec/frontend/editor/schema/ci/ci_schema_spec.js b/spec/frontend/editor/schema/ci/ci_schema_spec.js index f9f0e56d30c..fc86907c144 100644 --- a/spec/frontend/editor/schema/ci/ci_schema_spec.js +++ b/spec/frontend/editor/schema/ci/ci_schema_spec.js @@ -29,6 +29,7 @@ import CacheYaml from './yaml_tests/positive_tests/cache.yml'; import FilterYaml from './yaml_tests/positive_tests/filter.yml'; import IncludeYaml from './yaml_tests/positive_tests/include.yml'; import RulesYaml from './yaml_tests/positive_tests/rules.yml'; +import ProjectPathYaml from './yaml_tests/positive_tests/project_path.yml'; import VariablesYaml from './yaml_tests/positive_tests/variables.yml'; // YAML NEGATIVE TEST @@ -38,6 +39,27 @@ import IncludeNegativeYaml from './yaml_tests/negative_tests/include.yml'; import RulesNegativeYaml from './yaml_tests/negative_tests/rules.yml'; import VariablesNegativeYaml from './yaml_tests/negative_tests/variables.yml'; +import ProjectPathIncludeEmptyYaml from './yaml_tests/negative_tests/project_path/include/empty.yml'; +import ProjectPathIncludeInvalidVariableYaml from './yaml_tests/negative_tests/project_path/include/invalid_variable.yml'; +import ProjectPathIncludeLeadSlashYaml from './yaml_tests/negative_tests/project_path/include/leading_slash.yml'; +import ProjectPathIncludeNoSlashYaml from './yaml_tests/negative_tests/project_path/include/no_slash.yml'; +import ProjectPathIncludeTailSlashYaml from './yaml_tests/negative_tests/project_path/include/tailing_slash.yml'; +import ProjectPathTriggerIncludeEmptyYaml from './yaml_tests/negative_tests/project_path/trigger/include/empty.yml'; +import ProjectPathTriggerIncludeInvalidVariableYaml from './yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml'; +import ProjectPathTriggerIncludeLeadSlashYaml from './yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml'; +import ProjectPathTriggerIncludeNoSlashYaml from './yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml'; +import ProjectPathTriggerIncludeTailSlashYaml from './yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml'; +import ProjectPathTriggerMinimalEmptyYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml'; +import ProjectPathTriggerMinimalInvalidVariableYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml'; +import ProjectPathTriggerMinimalLeadSlashYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml'; +import ProjectPathTriggerMinimalNoSlashYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml'; +import ProjectPathTriggerMinimalTailSlashYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml'; +import ProjectPathTriggerProjectEmptyYaml from './yaml_tests/negative_tests/project_path/trigger/project/empty.yml'; +import ProjectPathTriggerProjectInvalidVariableYaml from './yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml'; +import ProjectPathTriggerProjectLeadSlashYaml from './yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml'; +import ProjectPathTriggerProjectNoSlashYaml from './yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml'; +import ProjectPathTriggerProjectTailSlashYaml from './yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml'; + const ajv = new Ajv({ strictTypes: false, strictTuples: false, @@ -70,6 +92,7 @@ describe('positive tests', () => { IncludeYaml, RulesYaml, VariablesYaml, + ProjectPathYaml, }), )('schema validates %s', (_, input) => { expect(input).toValidateJsonSchema(schema); @@ -94,6 +117,26 @@ describe('negative tests', () => { IncludeNegativeYaml, RulesNegativeYaml, VariablesNegativeYaml, + ProjectPathIncludeEmptyYaml, + ProjectPathIncludeInvalidVariableYaml, + ProjectPathIncludeLeadSlashYaml, + ProjectPathIncludeNoSlashYaml, + ProjectPathIncludeTailSlashYaml, + ProjectPathTriggerIncludeEmptyYaml, + ProjectPathTriggerIncludeInvalidVariableYaml, + ProjectPathTriggerIncludeLeadSlashYaml, + ProjectPathTriggerIncludeNoSlashYaml, + ProjectPathTriggerIncludeTailSlashYaml, + ProjectPathTriggerMinimalEmptyYaml, + ProjectPathTriggerMinimalInvalidVariableYaml, + ProjectPathTriggerMinimalLeadSlashYaml, + ProjectPathTriggerMinimalNoSlashYaml, + ProjectPathTriggerMinimalTailSlashYaml, + ProjectPathTriggerProjectEmptyYaml, + ProjectPathTriggerProjectInvalidVariableYaml, + ProjectPathTriggerProjectLeadSlashYaml, + ProjectPathTriggerProjectNoSlashYaml, + ProjectPathTriggerProjectTailSlashYaml, }), )('schema validates %s', (_, input) => { expect(input).not.toValidateJsonSchema(schema); diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/empty.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/empty.yml new file mode 100644 index 00000000000..d9838fbb6fd --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/empty.yml @@ -0,0 +1,3 @@ +include: + - project: '' + file: '/templates/.gitlab-ci-template.yml' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/invalid_variable.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/invalid_variable.yml new file mode 100644 index 00000000000..32933f856c7 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/invalid_variable.yml @@ -0,0 +1,3 @@ +include: + - project: 'slug#' + file: '/templates/.gitlab-ci-template.yml' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/leading_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/leading_slash.yml new file mode 100644 index 00000000000..c463318be31 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/leading_slash.yml @@ -0,0 +1,3 @@ +include: + - project: '/slug' + file: '/templates/.gitlab-ci-template.yml' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/no_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/no_slash.yml new file mode 100644 index 00000000000..51194a1d40c --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/no_slash.yml @@ -0,0 +1,3 @@ +include: + - project: 'slug' + file: '/templates/.gitlab-ci-template.yml' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/tailing_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/tailing_slash.yml new file mode 100644 index 00000000000..91f258888d8 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/include/tailing_slash.yml @@ -0,0 +1,3 @@ +include: + - project: 'slug/' + file: '/templates/.gitlab-ci-template.yml' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/empty.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/empty.yml new file mode 100644 index 00000000000..ee2bb3e8ace --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/empty.yml @@ -0,0 +1,5 @@ +trigger-include: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: '' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml new file mode 100644 index 00000000000..770305be0dc --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml @@ -0,0 +1,5 @@ +trigger-include: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug#' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml new file mode 100644 index 00000000000..82fd77cf0d3 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml @@ -0,0 +1,5 @@ +trigger-include: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: '/slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml new file mode 100644 index 00000000000..f4ea59c7945 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml @@ -0,0 +1,5 @@ +trigger-include: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml new file mode 100644 index 00000000000..a0195c03352 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml @@ -0,0 +1,5 @@ +trigger-include: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml new file mode 100644 index 00000000000..cad8dbbf430 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml @@ -0,0 +1,2 @@ +trigger-minimal: + trigger: '' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml new file mode 100644 index 00000000000..6ca37666d09 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml @@ -0,0 +1,2 @@ +trigger-minimal: + trigger: 'slug#' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml new file mode 100644 index 00000000000..9d7c6b44125 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml @@ -0,0 +1,2 @@ +trigger-minimal: + trigger: '/slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml new file mode 100644 index 00000000000..acd047477c8 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml @@ -0,0 +1,2 @@ +trigger-minimal: + trigger: 'slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml new file mode 100644 index 00000000000..0fdd00da3de --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml @@ -0,0 +1,2 @@ +trigger-minimal: + trigger: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/empty.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/empty.yml new file mode 100644 index 00000000000..0aa2330cecb --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/empty.yml @@ -0,0 +1,3 @@ +trigger-project: + trigger: + project: '' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml new file mode 100644 index 00000000000..3c17ec62039 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml @@ -0,0 +1,3 @@ +trigger-project: + trigger: + project: 'slug#' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml new file mode 100644 index 00000000000..f9884603171 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml @@ -0,0 +1,3 @@ +trigger-project: + trigger: + project: '/slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml new file mode 100644 index 00000000000..d89e09756eb --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml @@ -0,0 +1,3 @@ +trigger-project: + trigger: + project: 'slug' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml new file mode 100644 index 00000000000..3c39d6be4cb --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml @@ -0,0 +1,3 @@ +trigger-project: + trigger: + project: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/project_path.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/project_path.yml new file mode 100644 index 00000000000..8a12cdf4f15 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/project_path.yml @@ -0,0 +1,101 @@ +# Covers https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95469 +# Test cases: +# - include file from project +# - trigger pipeline from project, 3 forms (see schema at ci.json) +# +# Sub-cases - forms of project path: +# - common case: group/project +# - sub-group: group/sub-group/project +# - variable: $FOO +# - variable in string: group/$VAR/project +# - invalid variable: $. +# (testing regex, that does not validate variable names) + +# BEGIN CASE: include yml from project +include: + - project: 'group/project' + file: '/templates/.gitlab-ci-template.yml' + + - project: 'group/sub-group/project' + file: '/templates/.gitlab-ci-template.yml' + + - project: '$FOO' + file: '/templates/.gitlab-ci-template.yml' + + - project: 'group/$VAR/project' + file: '/templates/.gitlab-ci-template.yml' + + - project: '$.' + file: '/templates/.gitlab-ci-template.yml' +# END CASE + +# BEGIN CASE: trigger minimal +trigger-minimal: + trigger: 'group/project' + +trigger-minimal-sub-group: + trigger: 'group/sub-group/project' + +trigger-minimal-variable: + trigger: '$FOO' + +trigger-minimal-variable-in-string: + trigger: 'group/$VAR/project' + +trigger-minimal-invalid-variable: + trigger: '$.' +# END CASE + +# BEGIN CASE: trigger project +trigger-project: + trigger: + project: 'group/project' + +trigger-project-sub-group: + trigger: + project: 'group/sub-group/project' + +trigger-project-variable: + trigger: + project: '$FOO' + +trigger-project-variable-in-string: + trigger: + project: 'group/$VAR/project' + +trigger-project-invalid-variable: + trigger: + project: '$.' +# END CASE + +# BEGIN CASE: trigger file +trigger-include: + trigger: + include: + - project: 'group/project' + file: '/path/to/child-pipeline.yml' + +trigger-include-sub-group: + trigger: + include: + - project: 'group/sub-group/project' + file: '/path/to/child-pipeline.yml' + +trigger-include-variable: + trigger: + include: + - project: '$FOO' + file: '/path/to/child-pipeline.yml' + +trigger-include-variable-in-string: + trigger: + include: + - project: 'group/$VAR/project' + file: '/path/to/child-pipeline.yml' + +trigger-include-invalid-variable: + trigger: + include: + - project: '$.' + file: '/path/to/child-pipeline.yml' +# END CASE |