diff options
Diffstat (limited to 'spec/frontend/editor')
33 files changed, 327 insertions, 143 deletions
diff --git a/spec/frontend/editor/schema/ci/ci_schema_spec.js b/spec/frontend/editor/schema/ci/ci_schema_spec.js index fc86907c144..32126a5fd9a 100644 --- a/spec/frontend/editor/schema/ci/ci_schema_spec.js +++ b/spec/frontend/editor/schema/ci/ci_schema_spec.js @@ -18,9 +18,7 @@ import VariablesJson from './json_tests/positive_tests/variables.json'; 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'; -import ReleaseAssetsLinksEmptyJson from './json_tests/negative_tests/release_assets_links_empty.json'; -import ReleaseAssetsLinksInvalidLinkTypeJson from './json_tests/negative_tests/release_assets_links_invalid_link_type.json'; -import ReleaseAssetsLinksMissingJson from './json_tests/negative_tests/release_assets_links_missing.json'; +import ReleaseAssetsLinksJson from './json_tests/negative_tests/release_assets_links.json'; import RetryUnknownWhenJson from './json_tests/negative_tests/retry_unknown_when.json'; // YAML POSITIVE TEST @@ -31,34 +29,22 @@ 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'; +import JobWhenYaml from './yaml_tests/positive_tests/job_when.yml'; // YAML NEGATIVE TEST import ArtifactsNegativeYaml from './yaml_tests/negative_tests/artifacts.yml'; -import CacheNegativeYaml from './yaml_tests/negative_tests/cache.yml'; +import CacheKeyNeative 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'; -import VariablesNegativeYaml from './yaml_tests/negative_tests/variables.yml'; - +import JobWhenNegativeYaml from './yaml_tests/negative_tests/job_when.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'; +import RulesNegativeYaml from './yaml_tests/negative_tests/rules.yml'; +import TriggerNegative from './yaml_tests/negative_tests/trigger.yml'; +import VariablesInvalidSyntaxDescYaml from './yaml_tests/negative_tests/variables/invalid_syntax_desc.yml'; +import VariablesWrongSyntaxUsageExpand from './yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml'; const ajv = new Ajv({ strictTypes: false, @@ -68,7 +54,7 @@ const ajv = new Ajv({ ajv.addKeyword('markdownDescription'); AjvFormats(ajv); -const schema = ajv.compile(CiSchema); +const ajvSchema = ajv.compile(CiSchema); describe('positive tests', () => { it.each( @@ -90,12 +76,17 @@ describe('positive tests', () => { CacheYaml, FilterYaml, IncludeYaml, + JobWhenYaml, RulesYaml, VariablesYaml, ProjectPathYaml, }), )('schema validates %s', (_, input) => { - expect(input).toValidateJsonSchema(schema); + // We construct a new "JSON" from each main key that is inside a + // file which allow us to make sure each blob is valid. + Object.keys(input).forEach((key) => { + expect({ [key]: input[key] }).toValidateJsonSchema(ajvSchema); + }); }); }); @@ -106,39 +97,29 @@ describe('negative tests', () => { DefaultNoAdditionalPropertiesJson, JobVariablesMustNotContainObjectsJson, InheritDefaultNoAdditionalPropertiesJson, - ReleaseAssetsLinksEmptyJson, - ReleaseAssetsLinksInvalidLinkTypeJson, - ReleaseAssetsLinksMissingJson, + ReleaseAssetsLinksJson, RetryUnknownWhenJson, // YAML ArtifactsNegativeYaml, - CacheNegativeYaml, + CacheKeyNeative, IncludeNegativeYaml, + JobWhenNegativeYaml, RulesNegativeYaml, - VariablesNegativeYaml, + VariablesInvalidSyntaxDescYaml, + VariablesWrongSyntaxUsageExpand, ProjectPathIncludeEmptyYaml, ProjectPathIncludeInvalidVariableYaml, ProjectPathIncludeLeadSlashYaml, ProjectPathIncludeNoSlashYaml, ProjectPathIncludeTailSlashYaml, - ProjectPathTriggerIncludeEmptyYaml, - ProjectPathTriggerIncludeInvalidVariableYaml, - ProjectPathTriggerIncludeLeadSlashYaml, - ProjectPathTriggerIncludeNoSlashYaml, - ProjectPathTriggerIncludeTailSlashYaml, - ProjectPathTriggerMinimalEmptyYaml, - ProjectPathTriggerMinimalInvalidVariableYaml, - ProjectPathTriggerMinimalLeadSlashYaml, - ProjectPathTriggerMinimalNoSlashYaml, - ProjectPathTriggerMinimalTailSlashYaml, - ProjectPathTriggerProjectEmptyYaml, - ProjectPathTriggerProjectInvalidVariableYaml, - ProjectPathTriggerProjectLeadSlashYaml, - ProjectPathTriggerProjectNoSlashYaml, - ProjectPathTriggerProjectTailSlashYaml, + TriggerNegative, }), )('schema validates %s', (_, input) => { - expect(input).not.toValidateJsonSchema(schema); + // We construct a new "JSON" from each main key that is inside a + // file which allow us to make sure each blob is invalid. + Object.keys(input).forEach((key) => { + expect({ [key]: input[key] }).not.toValidateJsonSchema(ajvSchema); + }); }); }); diff --git a/spec/frontend/editor/schema/ci/json_tests/negative_tests/default_no_additional_properties.json b/spec/frontend/editor/schema/ci/json_tests/negative_tests/default_no_additional_properties.json index 955c19ef1ab..d30bc4649ab 100644 --- a/spec/frontend/editor/schema/ci/json_tests/negative_tests/default_no_additional_properties.json +++ b/spec/frontend/editor/schema/ci/json_tests/negative_tests/default_no_additional_properties.json @@ -9,4 +9,4 @@ "name": "test" } } -} +}
\ No newline at end of file diff --git a/spec/frontend/editor/schema/ci/json_tests/negative_tests/inherit_default_no_additional_properties.json b/spec/frontend/editor/schema/ci/json_tests/negative_tests/inherit_default_no_additional_properties.json index 7411e4c2434..1a31467f9ae 100644 --- a/spec/frontend/editor/schema/ci/json_tests/negative_tests/inherit_default_no_additional_properties.json +++ b/spec/frontend/editor/schema/ci/json_tests/negative_tests/inherit_default_no_additional_properties.json @@ -1,8 +1,10 @@ { "karma": { "inherit": { - "default": ["secrets"] + "default": [ + "secrets" + ] }, "script": "karma" } -} +}
\ No newline at end of file diff --git a/spec/frontend/editor/schema/ci/json_tests/negative_tests/job_variables_must_not_contain_objects.json b/spec/frontend/editor/schema/ci/json_tests/negative_tests/job_variables_must_not_contain_objects.json index bfdbf26ee70..68dd57824ab 100644 --- a/spec/frontend/editor/schema/ci/json_tests/negative_tests/job_variables_must_not_contain_objects.json +++ b/spec/frontend/editor/schema/ci/json_tests/negative_tests/job_variables_must_not_contain_objects.json @@ -1,7 +1,9 @@ { "gitlab-ci-variables-object": { "stage": "test", - "script": ["true"], + "script": [ + "true" + ], "variables": { "DEPLOY_ENVIRONMENT": { "value": "staging", @@ -9,4 +11,4 @@ } } } -} +}
\ No newline at end of file diff --git a/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_invalid_link_type.json b/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links.json index 048911aefa3..00b5b54c7e2 100644 --- a/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_invalid_link_type.json +++ b/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links.json @@ -1,4 +1,24 @@ { + "gitlab-ci-release-assets-links-missing": { + "script": "dostuff", + "stage": "deploy", + "release": { + "description": "Created using the release-cli $EXTRA_DESCRIPTION", + "tag_name": "$CI_COMMIT_TAG", + "assets": {} + } + }, + "gitlab-ci-release-assets-links-empty": { + "script": "dostuff", + "stage": "deploy", + "release": { + "description": "Created using the release-cli $EXTRA_DESCRIPTION", + "tag_name": "$CI_COMMIT_TAG", + "assets": { + "links": [] + } + } + }, "gitlab-ci-release-assets-links-invalid-link-type": { "script": "dostuff", "stage": "deploy", @@ -21,4 +41,4 @@ } } } -} +}
\ No newline at end of file diff --git a/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_empty.json b/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_empty.json deleted file mode 100644 index 84a1aa14698..00000000000 --- a/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_empty.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "gitlab-ci-release-assets-links-empty": { - "script": "dostuff", - "stage": "deploy", - "release": { - "description": "Created using the release-cli $EXTRA_DESCRIPTION", - "tag_name": "$CI_COMMIT_TAG", - "assets": { - "links": [] - } - } - } -} diff --git a/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_missing.json b/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_missing.json deleted file mode 100644 index 6f0b5a3bff8..00000000000 --- a/spec/frontend/editor/schema/ci/json_tests/negative_tests/release_assets_links_missing.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "gitlab-ci-release-assets-links-missing": { - "script": "dostuff", - "stage": "deploy", - "release": { - "description": "Created using the release-cli $EXTRA_DESCRIPTION", - "tag_name": "$CI_COMMIT_TAG", - "assets": {} - } - } -} diff --git a/spec/frontend/editor/schema/ci/json_tests/negative_tests/retry_unknown_when.json b/spec/frontend/editor/schema/ci/json_tests/negative_tests/retry_unknown_when.json index 433504f52c6..2c53ce07109 100644 --- a/spec/frontend/editor/schema/ci/json_tests/negative_tests/retry_unknown_when.json +++ b/spec/frontend/editor/schema/ci/json_tests/negative_tests/retry_unknown_when.json @@ -6,4 +6,4 @@ "when": "gitlab-ci-retry-object-unknown-when" } } -} +}
\ No newline at end of file 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 04020c06753..3979c9ae2ac 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,13 +1,62 @@ -stages: - - prepare +cache-key-files-not-an-array: + script: echo "This job uses a cache." + cache: + key: + files: package.json + paths: + - vendor/ruby + - node_modules + +cache-key-prefix-array: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: + - binaries-cache-$CI_JOB_NAME + paths: + - binaries/ + +cache-key-with-.: + script: echo "This job uses a cache." + cache: + key: . + paths: + - binaries/ + +cache-key-with-multiple-.: + stage: test + script: echo "This job uses a cache." + cache: + key: .. + paths: + - binaries/ + +cache-key-with-/: + script: echo "This job uses a cache." + cache: + key: binaries-ca/che + paths: + - binaries/ + +cache-path-not-an-array: + script: echo "This job uses a cache." + cache: + key: binaries-cache + paths: binaries/*.apk + +cache-untracked-string: + script: echo "This job uses a cache." + cache: + untracked: 'true' -# invalid cache:when values -when no integer: - stage: prepare +when_integer: + script: echo "This job uses a cache." cache: when: 0 -when must be a reserved word: - stage: prepare +when_not_reserved_keyword: + script: echo "This job uses a cache." 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 1e16bb55405..6afd8baa0e8 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,6 +1,3 @@ -stages: - - prepare - # invalid trigger:include trigger missing file property: stage: prepare diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/job_when.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/job_when.yml new file mode 100644 index 00000000000..d4e3911ff60 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/job_when.yml @@ -0,0 +1,11 @@ +job_with_wrong_when: + script: exit 0 + when: on_xyz + +job_with_boolean_when: + script: exit 0 + when: true + +job_with_array_when: + script: exit 0 + when: [on_success] 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 deleted file mode 100644 index ee2bb3e8ace..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/empty.yml +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 770305be0dc..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 82fd77cf0d3..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index f4ea59c7945..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index a0195c03352..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index cad8dbbf430..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 6ca37666d09..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 9d7c6b44125..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index acd047477c8..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 0fdd00da3de..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 0aa2330cecb..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/empty.yml +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 3c17ec62039..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index f9884603171..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index d89e09756eb..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 3c39d6be4cb..00000000000 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml +++ /dev/null @@ -1,3 +0,0 @@ -trigger-project: - trigger: - project: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/trigger.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/trigger.yml new file mode 100644 index 00000000000..73cc82f2f1c --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/trigger.yml @@ -0,0 +1,64 @@ +trigger-minimal-empty: + trigger: '' + +trigger-minimal-invalid-variable: + trigger: 'slug#' + +trigger-minimal-leading-slash: + trigger: '/slug' + +trigger-minimal-no-slash: + trigger: 'slug' + +trigger-minimal-trailing-slash: + trigger: 'slug/' + +trigger-project-empty: + trigger: + project: '' + +trigger-project-invalid-variable: + trigger: + project: 'slug#' + +trigger-project-leading-slash: + trigger: + project: '/slug' + +trigger-project-no-slash: + trigger: + project: 'slug' + +trigger-project-trailing-slash: + trigger: + project: 'slug/' + +trigger-include-empty: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: '' + +trigger-include-invalid: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug#' + +trigger-include-leading-slash: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: '/slug' + +trigger-include-no-slash: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug' + +trigger-include-trailing-slash: + trigger: + include: + - file: '/path/to/child-pipeline.yml' + project: 'slug/' diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/invalid_syntax_desc.yml index a7f23cf0d73..4916a6b354e 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/invalid_syntax_desc.yml @@ -1,4 +1,3 @@ -# invalid variable (unknown keyword is used) variables: FOO: value: BAR diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml new file mode 100644 index 00000000000..62bebfa57e7 --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml @@ -0,0 +1,4 @@ +variables: + RAW_VAR: + value: Hello $FOO + expand: okay 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 d83e14fdc6a..75918cd2a1b 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,24 +1,124 @@ -stages: - - prepare - # valid cache:when values job1: - stage: prepare script: - echo 'running job' cache: when: 'on_success' job2: - stage: prepare script: - echo 'running job' cache: when: 'on_failure' job3: - stage: prepare script: - echo 'running job' cache: when: 'always' + +# valid cache:paths +cache-paths: + script: echo "This job uses a cache." + cache: + key: binaries-cache + paths: + - binaries/*.apk + - .config + +# valid cache:key +cache-key-string: + script: echo "This job uses a cache." + cache: + key: random-string + paths: + - binaries/ + +cache-key-string-with-dots: + script: echo "This job uses a cache." + cache: + key: random-..string + paths: + - binaries/ + +cache-key-string-beginning-with-dot: + script: echo "This job uses a cache." + cache: + key: .random-string + paths: + - binaries/ + +cache-key-string-ending-with-dot: + script: echo "This job uses a cache." + cache: + key: random-string. + paths: + - binaries/ + +cache-key-predefined-variable: + script: echo "This job uses a cache." + cache: + key: $CI_COMMIT_REF_SLUG + paths: + - binaries/ + +cache-key-combination: + script: echo "This job uses a cache." + cache: + key: binaries-cache-$CI_COMMIT_REF_SLUG + paths: + - binaries/ + +# valid cache:key:files +cache-key-files: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + - package.json + paths: + - vendor/ruby + - node_modules + +# valide cache:key:prefix +cache-key-prefix-string: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: random-string + paths: + - binaries/ + +cache-key-prefix-predefined-variable: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: $CI_JOB_NAME + paths: + - binaries/ + +cache-key-prefix-combination: + script: echo "This job uses a cache." + cache: + key: + files: + - Gemfile.lock + prefix: binaries-cache-$CI_JOB_NAME + paths: + - binaries/ + +# valid cache:untracked +cache-untracked-true: + script: test + cache: + untracked: true + +cache-untracked-false: + script: test + cache: + untracked: false diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/job_when.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/job_when.yml new file mode 100644 index 00000000000..2a684a78f4e --- /dev/null +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/job_when.yml @@ -0,0 +1,10 @@ +job_with_no_when: + script: exit 0 + +job_with_when_always: + script: exit 0 + when: always + +job_with_when_on_failure: + script: exit 0 + when: on_failure diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml index ee71087a72e..53d020c432f 100644 --- a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml +++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/variables.yml @@ -6,3 +6,13 @@ variables: description: "A single value variable" DEPLOY_ENVIRONMENT: description: "A multi-value variable" + RAW_VAR: + value: "Hello $FOO" + expand: false + +rspec: + script: rspec + variables: + RAW_VAR2: + value: "Hello $DEPLOY_ENVIRONMENT" + expand: false
\ No newline at end of file diff --git a/spec/frontend/editor/source_editor_markdown_livepreview_ext_spec.js b/spec/frontend/editor/source_editor_markdown_livepreview_ext_spec.js index 1ff351b6554..19ebe0e3cb7 100644 --- a/spec/frontend/editor/source_editor_markdown_livepreview_ext_spec.js +++ b/spec/frontend/editor/source_editor_markdown_livepreview_ext_spec.js @@ -81,9 +81,18 @@ describe('Markdown Live Preview Extension for Source Editor', () => { }, path: previewMarkdownPath, actionShowPreviewCondition: expect.any(Object), + eventEmitter: expect.any(Object), }); }); + it('support external preview trigger via emitter event', () => { + expect(panelSpy).not.toHaveBeenCalled(); + + instance.markdownPreview.eventEmitter.fire(); + + expect(panelSpy).toHaveBeenCalled(); + }); + describe('onDidLayoutChange', () => { const emitter = new Emitter(); let layoutSpy; |