Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-06-22 21:08:26 +00:00
parent 2bb1dbf21f
commit f5ef42977e
24 changed files with 126 additions and 233 deletions

View File

@ -255,7 +255,7 @@ gem 'slack-messenger', '~> 2.3.4'
gem 'hangouts-chat', '~> 0.0.5', require: 'hangouts_chat'
# Asana integration
gem 'asana', '~> 0.10.3'
gem 'asana', '~> 0.10.13'
# FogBugz integration
gem 'ruby-fogbugz', '~> 0.2.1'

View File

@ -83,11 +83,11 @@ GEM
apollo_upload_server (2.1.0)
actionpack (>= 4.2)
graphql (>= 1.8)
asana (0.10.3)
asana (0.10.13)
faraday (~> 1.0)
faraday_middleware (~> 1.0)
faraday_middleware-multi_json (~> 0.0)
oauth2 (~> 1.4)
oauth2 (>= 1.4, < 3)
asciidoctor (2.0.15)
asciidoctor-include-ext (0.4.0)
asciidoctor (>= 1.5.6, < 3.0.0)
@ -1454,7 +1454,7 @@ DEPENDENCIES
addressable (~> 2.8)
akismet (~> 3.0)
apollo_upload_server (~> 2.1.0)
asana (~> 0.10.3)
asana (~> 0.10.13)
asciidoctor (~> 2.0.10)
asciidoctor-include-ext (~> 0.4.0)
asciidoctor-kroki (~> 0.5.0)

View File

@ -54,25 +54,25 @@ export default {
<ide-tree-list @tree-ready="$emit('tree-ready')">
<template #header>
{{ __('Edit') }}
<div class="ide-tree-actions ml-auto d-flex" data-testid="ide-root-actions">
<div class="ide-tree-actions gl-ml-auto gl-display-flex" data-testid="ide-root-actions">
<new-entry-button
:label="__('New file')"
:show-label="false"
class="d-flex border-0 p-0 mr-3"
class="gl-display-flex gl-border-0 gl-p-0 gl-mr-5"
icon="doc-new"
data-qa-selector="new_file_button"
@click="createNewFile()"
/>
<upload
:show-label="false"
class="d-flex mr-3"
button-css-classes="border-0 p-0"
class="gl-display-flex gl-mr-5"
button-css-classes="gl-border-0 gl-p-0"
@create="createTempEntry"
/>
<new-entry-button
:label="__('New directory')"
:show-label="false"
class="d-flex border-0 p-0"
class="gl-display-flex gl-border-0 gl-p-0"
icon="folder-new"
data-qa-selector="new_directory_button"
@click="createNewFolder()"

View File

@ -1,6 +1,7 @@
<script>
import { GlBadge, GlTab, GlTabs, GlLoadingIcon } from '@gitlab/ui';
import { s__ } from '~/locale';
import { limitedCounterWithDelimiter } from '~/lib/utils/text_utility';
export default {
components: {
@ -29,7 +30,7 @@ export default {
return [
{
text: s__('Jobs|All'),
count: this.allJobsCount,
count: limitedCounterWithDelimiter(this.allJobsCount),
scope: null,
testId: 'jobs-all-tab',
showBadge: true,

View File

@ -498,3 +498,17 @@ export const markdownConfig = {
* escaped to `'fix-'\''bug-behavior'\'''`.
*/
export const escapeShellString = (str) => `'${str.replace(allSingleQuotes, () => "'\\''")}'`;
/**
* Adds plus character as delimiter for count
* if count is greater than limit of 1000
* FE creation of `app/helpers/numbers_helper.rb`
*
* @param {Number} count
* @return {Number|String}
*/
export const limitedCounterWithDelimiter = (count) => {
const limit = 1000;
return count > limit ? '1,000+' : count;
};

View File

@ -6,7 +6,7 @@
%p= _('Transfer group to another parent group.')
= form_for group, url: transfer_group_path(group), method: :put, html: { id: form_id, class: 'js-group-transfer-form' } do |f|
%ul
- learn_more_link_start = '<a href="https://docs.gitlab.com/ee/user/project/index.html#redirects-when-changing-repository-paths" target="_blank" rel="noopener noreferrer">'.html_safe
- learn_more_link_start = '<a href="https://docs.gitlab.com/ee/user/project/repository/index.html#what-happens-when-a-repository-path-changes" target="_blank" rel="noopener noreferrer">'.html_safe
- warning_text = s_("GroupSettings|Be careful. Changing a group's parent can have unintended side effects. %{learn_more_link_start}Learn more.%{learn_more_link_end}") % { learn_more_link_start: learn_more_link_start, learn_more_link_end: '</a>'.html_safe }
%li= warning_text.html_safe
%li= s_('GroupSettings|You can only transfer the group to a group you manage.')

View File

@ -785,6 +785,8 @@ the `approvals_before_merge` parameter:
field `merge_user` can be either user who merged this merge request,
user who set it to merge when pipeline succeeds or `null`.
Field `merged_by` (user who merged this merge request or `null`) has been deprecated.
- `pipeline` is an old parameter and should not be used. Use `head_pipeline` instead,
as it is faster and returns more information.
## Get single MR participants

View File

@ -136,10 +136,10 @@ NOTE:
#### Markdown snapshot testing
_Markdown snapshot testing_ refers to the automated testing performed in
the GitLab codebase, which is driven by snapshot fixture data derived from the
GLFM specification. It consists of both backend RSpec tests and frontend Jest tests
which use the fixture data. This fixture data is contained in YAML files. These files
can be generated and updated based on the Markdown examples in the specification,
the GitLab codebase, which is driven by "example_snapshots" fixture data derived from all of
the examples in the GLFM specification. It consists of both backend RSpec tests and frontend Jest
tests which use the fixture data. This fixture data is contained in YAML files. These files
are generated and updated based on the Markdown examples in the specification,
and the existing GLFM parser and render implementations. They may also be
manually updated as necessary to test-drive incomplete implementations.
Regarding the terminology used here:
@ -159,7 +159,7 @@ Regarding the terminology used here:
[Jest snapshot testing](https://jestjs.io/docs/snapshot-testing), as used elsewhere
in the GitLab frontend testing suite. However, the Markdown snapshot testing does
follow the same philosophy and patterns as Jest snapshot testing:
1. Snapshot fixture data is represented as files which are checked into source control.
1. Snapshot example fixture data is represented as files which are checked into source control.
1. The files can be automatically generated and updated based on the implementation
of the code under tests.
1. The files can also be manually updated when necessary, for example, to test-drive
@ -168,9 +168,15 @@ Regarding the terminology used here:
[Rails database fixture files](https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html).
It instead refers to _test fixtures_ in the
[more generic definition](https://en.wikipedia.org/wiki/Test_fixture#Software),
as input data to support automated testing. However, fixture files still exist, so
they are colocated under the `spec/fixtures` directory with the rest of
the fixture data for the GitLab Rails application.
as input data to support automated testing.
1. These example snapshots fixture files are generated from and closely related to the rest of the
GLFM specification. Therefore, the `example_snapshots` directory is colocated under the
`glfm_specification` directory with the rest of the
GLFM [specification files](#specification-files). They are intentionally _not_
located under the `spec/fixtures` directory with the rest of
the fixture data for the GitLab Rails application. In practice, developers have found
it simpler and more understandable to have everything under the `glfm_specification` directory
rather than splitting these files into the `spec/fixtures` directory.
<!-- vale gitlab.InclusionCultural = YES -->
@ -395,9 +401,10 @@ The documentation on the implementation is split into three sections:
1. [Scripts](#scripts).
1. [Specification files](#specification-files).
1. Example snapshot files: These YAML files are used as input data
1. [Example snapshot files](#example-snapshot-files):
These YAML files are used as input data
or fixtures to drive the various tests, and are located under
`spec/fixtures/glfm/example_snapshots`. All example snapshot files are automatically
`glfm_specification/example_snapshots`. All example snapshot files are automatically
generated based on the specification files and the implementation of the parsers and renderers.
However, they can also be directly edited if necessary, such as to
test-drive an incomplete implementation.
@ -662,16 +669,16 @@ controls the behavior of the [scripts](#scripts) and [tests](#types-of-markdown-
The following optional entries are supported for each example. They all default to `false`:
- `skip_update_example_snapshots`: When true, skips any addition or update of any this example's entries
in the [`spec/fixtures/glfm/example_snapshots/html.yml`](#specfixturesglfmexample_snapshotshtmlyml) file
or the [`spec/fixtures/glfm/example_snapshots/prosemirror_json.yml`](#specfixturesglfmexample_snapshotsprosemirror_jsonyml) file.
in the [`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) file
or the [`glfm_specification/example_snapshots/prosemirror_json.yml`](#glfm_specificationexample_snapshotsprosemirror_jsonyml) file.
If this value is truthy, then no other `skip_update_example_snapshot_*` entries can be truthy,
and an error is raised if any of them are.
- `skip_update_example_snapshot_html_static`: When true, skips addition or update of this example's [static HTML](#static-html)
entry in the [`spec/fixtures/glfm/example_snapshots/html.yml`](#specfixturesglfmexample_snapshotshtmlyml) file.
entry in the [`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) file.
- `skip_update_example_snapshot_html_wysiwyg`: When true, skips addition or update of this example's [WYSIWYG HTML](#wysiwyg-html)
entry in the [`spec/fixtures/glfm/example_snapshots/html.yml`](#specfixturesglfmexample_snapshotshtmlyml) file.
entry in the [`glfm_specification/example_snapshots/html.yml`](#glfm_specificationexample_snapshotshtmlyml) file.
- `skip_update_example_snapshot_prosemirror_json`: When true, skips addition or update of this example's
entry in the [`spec/fixtures/glfm/example_snapshots/prosemirror_json.yml`](#specfixturesglfmexample_snapshotsprosemirror_jsonyml) file.
entry in the [`glfm_specification/example_snapshots/prosemirror_json.yml`](#glfm_specificationexample_snapshotsprosemirror_jsonyml) file.
- `skip_running_conformance_static_tests`: When true, skips running the [Markdown conformance tests](#markdown-conformance-testing)
of the [static HTML](#static-html) for this example.
- `skip_running_conformance_wysiwyg_tests`: When true, skips running the [Markdown conformance tests](#markdown-conformance-testing)
@ -681,7 +688,7 @@ The following optional entries are supported for each example. They all default
- `skip_running_snapshot_wysiwyg_html_tests`: When true, skips running the [Markdown snapshot tests](#markdown-snapshot-testing)
of the [WYSIWYG HTML](#wysiwyg-html) for this example.
- `skip_running_snapshot_prosemirror_json_tests`: When true, skips running the [Markdown snapshot tests](#markdown-snapshot-testing)
of the [ProseMirror JSON](#specfixturesglfmexample_snapshotsprosemirror_jsonyml) for this example.
of the [ProseMirror JSON](#glfm_specificationexample_snapshotsprosemirror_jsonyml) for this example.
`glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.yml` sample entry:
@ -808,9 +815,9 @@ key in `glfm_specification/input/gitlab_flavored_markdown/glfm_example_status.ym
can be used to disable automatic generation of some examples. They can instead
be manually edited as necessary to help drive the implementations.
#### `spec/fixtures/glfm/example_snapshots/examples_index.yml`
#### `glfm_specification/example_snapshots/examples_index.yml`
[`spec/fixtures/glfm/example_snapshots/examples_index.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/fixtures/glfm/example_snapshots/examples_index.yml)
[`glfm_specification/example_snapshots/examples_index.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/examples_index.yml)
is the main list of all
CommonMark, GFM, and GLFM example names, each with a unique canonical name.
@ -836,7 +843,7 @@ CommonMark, GFM, and GLFM example names, each with a unique canonical name.
examples where multiple examples exist for the same Section 7 subsection are
added to the end of the sub-section.
`spec/fixtures/glfm/example_snapshots/examples_index.yml` sample entries:
`glfm_specification/example_snapshots/examples_index.yml` sample entries:
```yaml
02_01_preliminaries_characters_and_lines_1:
@ -856,10 +863,10 @@ CommonMark, GFM, and GLFM example names, each with a unique canonical name.
source_specification: gitlab
```
#### `spec/fixtures/glfm/example_snapshots/markdown.yml`
#### `glfm_specification/example_snapshots/markdown.yml`
[`spec/fixtures/glfm/example_snapshots/markdown.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/fixtures/glfm/example_snapshots/markdown.yml) contains the original Markdown
for each entry in `spec/fixtures/glfm/example_snapshots/examples_index.yml`
[`glfm_specification/example_snapshots/markdown.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/markdown.yml) contains the original Markdown
for each entry in `glfm_specification/example_snapshots/examples_index.yml`
- For CommonMark and GFM Markdown,
it is generated (or updated) from the standard GFM
@ -868,17 +875,17 @@ for each entry in `spec/fixtures/glfm/example_snapshots/examples_index.yml`
`glfm_specification/input/gitlab_flavored_markdown/glfm_canonical_examples.txt`
input specification file.
`spec/fixtures/glfm/example_snapshots/markdown.yml` sample entry:
`glfm_specification/example_snapshots/markdown.yml` sample entry:
```yaml
06_04_inlines_emphasis_and_strong_emphasis_1: |
*foo bar*
```
#### `spec/fixtures/glfm/example_snapshots/html.yml`
#### `glfm_specification/example_snapshots/html.yml`
[`spec/fixtures/glfm/example_snapshots/html.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/fixtures/glfm/example_snapshots/html.yml)
contains the HTML for each entry in `spec/fixtures/glfm/example_snapshots/examples_index.yml`
[`glfm_specification/example_snapshots/html.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/html.yml)
contains the HTML for each entry in `glfm_specification/example_snapshots/examples_index.yml`
Three types of entries exist, with different HTML for each:
@ -889,13 +896,13 @@ Three types of entries exist, with different HTML for each:
`glfm_specification/input/gitlab_flavored_markdown/glfm_canonical_examples.txt`.
- **Static**
- This is the static (backend (Ruby)-generated) HTML for each entry in
`spec/fixtures/glfm/example_snapshots/examples_index.yml`.
`glfm_specification/example_snapshots/examples_index.yml`.
- It is generated/updated from backend [Markdown API](../../../api/markdown.md)
(or the underlying internal classes) via the `update-example-snapshots.rb` script,
but can be manually updated for static examples with incomplete implementations.
- **WYSIWYG**
- The WYSIWYG (frontend, JavaScript-generated) HTML for each entry in
`spec/fixtures/glfm/example_snapshots/examples_index.yml`.
`glfm_specification/example_snapshots/examples_index.yml`.
- It is generated (or updated) from the frontend Content Editor implementation via the
`update-example-snapshots.rb` script. It can be manually updated for WYSIWYG
examples with incomplete implementations.
@ -903,7 +910,7 @@ Three types of entries exist, with different HTML for each:
Any exceptions or failures which occur when generating HTML are replaced with an
`Error - check implementation` value.
`spec/fixtures/glfm/example_snapshots/html.yml` sample entry:
`glfm_specification/example_snapshots/html.yml` sample entry:
```yaml
06_04_inlines_emphasis_and_strong_emphasis_1:
@ -919,16 +926,16 @@ NOTE:
The actual `static` or `WYSIWYG` entries may differ from the example `html.yml`,
depending on how the implementations evolve.
#### `spec/fixtures/glfm/example_snapshots/prosemirror_json.yml`
#### `glfm_specification/example_snapshots/prosemirror_json.yml`
[`spec/fixtures/glfm/example_snapshots/prosemirror_json.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/fixtures/glfm/example_snapshots/prosemirror_json.yml)
contains the ProseMirror JSON for each entry in `spec/fixtures/glfm/example_snapshots/examples_index.yml`
[`glfm_specification/example_snapshots/prosemirror_json.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/glfm_specification/example_snapshots/prosemirror_json.yml)
contains the ProseMirror JSON for each entry in `glfm_specification/example_snapshots/examples_index.yml`
- It is generated (or updated) from the frontend code via the `update-example-snapshots.rb`
script, but can be manually updated for examples with incomplete implementations.
- Any exceptions or failures when generating are replaced with a `Error - check implementation` value.
`spec/fixtures/glfm/example_snapshots/prosemirror_json.yml` sample entry:
`glfm_specification/example_snapshots/prosemirror_json.yml` sample entry:
```yaml
06_04_inlines_emphasis_and_strong_emphasis_1: |-

View File

@ -81,6 +81,10 @@ module Gitlab
:update_gateway,
to: :istio_client
delegate :get_ingresses, :patch_ingress, to: :networking_client
delegate :get_deployments, to: :apps_client
attr_reader :api_prefix, :kubeclient_options
DEFAULT_KUBECLIENT_OPTIONS = {
@ -127,46 +131,6 @@ module Gitlab
validate_url!
end
# Deployments resource is currently on the apis/extensions api group
# until Kubernetes 1.15. Kubernetest 1.16+ has deployments resources in
# the apis/apps api group.
#
# As we still support Kubernetes 1.12+, we will need to support both.
def get_deployments(**args)
extensions_client.discover unless extensions_client.discovered
if extensions_client.respond_to?(:get_deployments)
extensions_client.get_deployments(**args)
else
apps_client.get_deployments(**args)
end
end
# Ingresses resource is currently on the apis/extensions api group
# until Kubernetes 1.21. Kubernetest 1.22+ has ingresses resources in
# the networking.k8s.io/v1 api group.
#
# As we still support Kubernetes 1.12+, we will need to support both.
def get_ingresses(**args)
extensions_client.discover unless extensions_client.discovered
if extensions_client.respond_to?(:get_ingresses)
extensions_client.get_ingresses(**args)
else
networking_client.get_ingresses(**args)
end
end
def patch_ingress(*args)
extensions_client.discover unless extensions_client.discovered
if extensions_client.respond_to?(:patch_ingress)
extensions_client.patch_ingress(*args)
else
networking_client.patch_ingress(*args)
end
end
def create_or_update_cluster_role_binding(resource)
update_cluster_role_binding(resource)
end

View File

@ -41118,9 +41118,6 @@ msgstr ""
msgid "UsageQuota|Audio samples, videos, datasets, and graphics."
msgstr ""
msgid "UsageQuota|Because of a known issue, the artifact total for some projects may be incorrect. For more details, read %{warningLinkStart}the epic%{warningLinkEnd}."
msgstr ""
msgid "UsageQuota|Buy additional minutes"
msgstr ""

View File

@ -247,7 +247,7 @@
"prosemirror-test-builder": "^1.0.6",
"purgecss": "^4.0.3",
"purgecss-from-html": "^4.0.3",
"sass": "^1.32.12",
"sass": "^1.49.9",
"stylelint": "^14.3.0",
"timezone-mock": "^1.0.8",
"vue-jest": "4.0.1",

View File

@ -21,7 +21,7 @@ module Glfm
GLFM_SPEC_TXT_PATH = specification_path.join('output/spec.txt')
# Example Snapshot (ES) files
es_fixtures_path = File.expand_path("../../../spec/fixtures/glfm/example_snapshots", __dir__)
es_fixtures_path = File.expand_path("../../../glfm_specification/example_snapshots", __dir__)
ES_EXAMPLES_INDEX_YML_PATH = File.join(es_fixtures_path, 'examples_index.yml')
ES_MARKDOWN_YML_PATH = File.join(es_fixtures_path, 'markdown.yml')
ES_HTML_YML_PATH = File.join(es_fixtures_path, 'html.yml')

View File

@ -5,19 +5,6 @@ jest.mock('~/emoji');
const glfmSpecificationDir = path.join(__dirname, '..', '..', '..', 'glfm_specification');
const glfmExampleSnapshotsDir = path.join(
__dirname,
'..',
'..',
'fixtures',
'glfm',
'example_snapshots',
);
// See https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#markdown-snapshot-testing
// for documentation on this spec.
describeMarkdownSnapshots(
'CE markdown snapshots in ContentEditor',
glfmSpecificationDir,
glfmExampleSnapshotsDir,
);
describeMarkdownSnapshots('CE markdown snapshots in ContentEditor', glfmSpecificationDir);

View File

@ -25,11 +25,7 @@ const loadExamples = (dir, fileName) => {
};
// eslint-disable-next-line jest/no-export
export const describeMarkdownSnapshots = (
description,
glfmSpecificationDir,
glfmExampleSnapshotsDir,
) => {
export const describeMarkdownSnapshots = (description, glfmSpecificationDir) => {
let actualHtmlAndJsonExamples;
let skipRunningSnapshotWysiwygHtmlTests;
let skipRunningSnapshotProsemirrorJsonTests;
@ -38,6 +34,7 @@ export const describeMarkdownSnapshots = (
path.join(glfmSpecificationDir, 'input', 'gitlab_flavored_markdown'),
'glfm_example_status.yml',
);
const glfmExampleSnapshotsDir = path.join(glfmSpecificationDir, 'example_snapshots');
const markdownExamples = loadExamples(glfmExampleSnapshotsDir, 'markdown.yml');
const expectedHtmlExamples = loadExamples(glfmExampleSnapshotsDir, 'html.yml');
const expectedProseMirrorJsonExamples = loadExamples(

View File

@ -384,4 +384,17 @@ describe('text_utility', () => {
);
});
});
describe('limitedCounterWithDelimiter', () => {
it('returns 1,000+ for count greater than 1000', () => {
const expectedOutput = '1,000+';
expect(textUtils.limitedCounterWithDelimiter(1001)).toBe(expectedOutput);
expect(textUtils.limitedCounterWithDelimiter(2300)).toBe(expectedOutput);
});
it('returns exact number for count less than 1000', () => {
expect(textUtils.limitedCounterWithDelimiter(120)).toBe(120);
});
});
});

View File

@ -171,20 +171,6 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do
end
end
describe '#extensions_client' do
subject { client.extensions_client }
it_behaves_like 'a Kubeclient'
it 'has the extensions API group endpoint' do
expect(subject.api_endpoint.to_s).to match(%r{\/apis\/extensions\Z})
end
it 'has the api_version' do
expect(subject.instance_variable_get(:@api_version)).to eq('v1beta1')
end
end
describe '#istio_client' do
subject { client.istio_client }
@ -307,86 +293,38 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do
end
end
describe '#get_deployments' do
let(:extensions_client) { client.extensions_client }
describe 'apps/v1 API group' do
let(:apps_client) { client.apps_client }
include_examples 'redirection not allowed', 'get_deployments'
include_examples 'dns rebinding not allowed', 'get_deployments'
it 'delegates to the extensions client' do
expect(extensions_client).to receive(:get_deployments)
client.get_deployments
end
context 'extensions does not have deployments for Kubernetes 1.16+ clusters' do
before do
WebMock
.stub_request(:get, api_url + '/apis/extensions/v1beta1')
.to_return(kube_response(kube_1_16_extensions_v1beta1_discovery_body))
end
describe 'get_deployments' do
include_examples 'redirection not allowed', 'get_deployments'
include_examples 'dns rebinding not allowed', 'get_deployments'
it 'delegates to the apps client' do
expect(apps_client).to receive(:get_deployments)
expect(client).to delegate_method(:get_deployments).to(:apps_client)
end
client.get_deployments
it 'responds to the method' do
expect(client).to respond_to :get_deployments
end
end
end
describe '#get_ingresses' do
let(:extensions_client) { client.extensions_client }
describe 'networking.k8s.io/v1 API group' do
let(:networking_client) { client.networking_client }
include_examples 'redirection not allowed', 'get_ingresses'
include_examples 'dns rebinding not allowed', 'get_ingresses'
[:get_ingresses, :patch_ingress].each do |method|
describe "##{method}" do
include_examples 'redirection not allowed', method
include_examples 'dns rebinding not allowed', method
it 'delegates to the extensions client' do
expect(extensions_client).to receive(:get_ingresses)
it 'delegates to the networking client' do
expect(client).to delegate_method(method).to(:networking_client)
end
client.get_ingresses
end
context 'extensions does not have deployments for Kubernetes 1.22+ clusters' do
before do
WebMock
.stub_request(:get, api_url + '/apis/extensions/v1beta1')
.to_return(kube_response(kube_1_22_extensions_v1beta1_discovery_body))
end
it 'delegates to the apps client' do
expect(networking_client).to receive(:get_ingresses)
client.get_ingresses
end
end
end
describe '#patch_ingress' do
let(:extensions_client) { client.extensions_client }
let(:networking_client) { client.networking_client }
include_examples 'redirection not allowed', 'patch_ingress'
include_examples 'dns rebinding not allowed', 'patch_ingress'
it 'delegates to the extensions client' do
expect(extensions_client).to receive(:patch_ingress)
client.patch_ingress
end
context 'extensions does not have ingress for Kubernetes 1.22+ clusters' do
before do
WebMock
.stub_request(:get, api_url + '/apis/extensions/v1beta1')
.to_return(kube_response(kube_1_22_extensions_v1beta1_discovery_body))
end
it 'delegates to the apps client' do
expect(networking_client).to receive(:patch_ingress)
client.patch_ingress
it 'responds to the method' do
expect(client).to respond_to method
end
end
end
end

View File

@ -7,6 +7,5 @@ require 'spec_helper'
RSpec.describe API::Markdown, 'Snapshot' do
# noinspection RubyMismatchedArgumentType (ignore RBS type warning: __dir__ can be nil, but 2nd argument can't be nil)
glfm_specification_dir = File.expand_path('../../../glfm_specification', __dir__)
glfm_example_snapshots_dir = File.expand_path('../../fixtures/glfm/example_snapshots', __dir__)
include_context 'with API::Markdown Snapshot shared context', glfm_specification_dir, glfm_example_snapshots_dir
include_context 'with API::Markdown Snapshot shared context', glfm_specification_dir
end

View File

@ -39,9 +39,6 @@ module KubernetesHelpers
def stub_kubeclient_discover_base(api_url)
WebMock.stub_request(:get, api_url + '/api/v1').to_return(kube_response(kube_v1_discovery_body))
WebMock
.stub_request(:get, api_url + '/apis/extensions/v1beta1')
.to_return(kube_response(kube_extensions_v1beta1_discovery_body))
WebMock
.stub_request(:get, api_url + '/apis/apps/v1')
.to_return(kube_response(kube_apps_v1_discovery_body))
@ -149,7 +146,7 @@ module KubernetesHelpers
def stub_kubeclient_deployments(namespace, status: nil)
stub_kubeclient_discover(service.api_url)
deployments_url = service.api_url + "/apis/extensions/v1beta1/namespaces/#{namespace}/deployments"
deployments_url = service.api_url + "/apis/apps/v1/namespaces/#{namespace}/deployments"
response = { status: status } if status
WebMock.stub_request(:get, deployments_url).to_return(response || kube_deployments_response)
@ -157,7 +154,7 @@ module KubernetesHelpers
def stub_kubeclient_ingresses(namespace, status: nil, method: :get, resource_path: "", response: kube_ingresses_response)
stub_kubeclient_discover(service.api_url)
ingresses_url = service.api_url + "/apis/extensions/v1beta1/namespaces/#{namespace}/ingresses#{resource_path}"
ingresses_url = service.api_url + "/apis/networking.k8s.io/v1/namespaces/#{namespace}/ingresses#{resource_path}"
response = { status: status } if status
WebMock.stub_request(method, ingresses_url).to_return(response)
@ -314,24 +311,6 @@ module KubernetesHelpers
}
end
# From Kubernetes 1.16+ Deployments are no longer served from apis/extensions
def kube_1_16_extensions_v1beta1_discovery_body
{
"kind" => "APIResourceList",
"resources" => [
{ "name" => "ingresses", "namespaced" => true, "kind" => "Deployment" }
]
}
end
# From Kubernetes 1.22+ Ingresses are no longer served from apis/extensions
def kube_1_22_extensions_v1beta1_discovery_body
{
"kind" => "APIResourceList",
"resources" => []
}
end
def kube_knative_discovery_body
{
"kind" => "APIResourceList",
@ -339,18 +318,6 @@ module KubernetesHelpers
}
end
def kube_extensions_v1beta1_discovery_body
{
"kind" => "APIResourceList",
"resources" => [
{ "name" => "deployments", "namespaced" => true, "kind" => "Deployment" },
{ "name" => "ingresses", "namespaced" => true, "kind" => "Ingress" }
]
}
end
# Yes, deployments are defined in both apis/extensions/v1beta1 and apis/v1
# (for Kubernetes < 1.16). This matches what Kubenetes API server returns.
def kube_apps_v1_discovery_body
{
"kind" => "APIResourceList",

View File

@ -5,12 +5,12 @@ require 'spec_helper'
# See https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#markdown-snapshot-testing
# for documentation on this spec.
# rubocop:disable Layout/LineLength
RSpec.shared_context 'with API::Markdown Snapshot shared context' do |glfm_specification_dir, glfm_example_snapshots_dir|
RSpec.shared_context 'with API::Markdown Snapshot shared context' do |glfm_specification_dir|
# rubocop:enable Layout/LineLength
include ApiHelpers
markdown_examples, html_examples = %w[markdown.yml html.yml].map do |file_name|
yaml = File.read("#{glfm_example_snapshots_dir}/#{file_name}")
yaml = File.read("#{glfm_specification_dir}/example_snapshots/#{file_name}")
YAML.safe_load(yaml, symbolize_names: true, aliases: true)
end

View File

@ -6920,6 +6920,11 @@ immer@^7.0.7:
resolved "https://registry.yarnpkg.com/immer/-/immer-7.0.7.tgz#9dfe713d49bf871cc59aedfce59b1992fa37a977"
integrity sha512-Q8yYwVADJXrNfp1ZUAh4XDHkcoE3wpdpb4mC5abDSajs2EbW8+cGdPyAnglMyLnm7EF6ojD2xBFX7L5i4TIytw==
immutable@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef"
integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==
import-fresh@^3.0.0, import-fresh@^3.2.1:
version "3.3.0"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
@ -11132,12 +11137,14 @@ sane@^4.0.3:
minimist "^1.1.1"
walker "~1.0.5"
sass@^1.32.12:
version "1.32.12"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.32.12.tgz#a2a47ad0f1c168222db5206444a30c12457abb9f"
integrity sha512-zmXn03k3hN0KaiVTjohgkg98C3UowhL1/VSGdj4/VAAiMKGQOE80PFPxFP2Kyq0OUskPKcY5lImkhBKEHlypJA==
sass@^1.49.9:
version "1.49.9"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.49.9.tgz#b15a189ecb0ca9e24634bae5d1ebc191809712f9"
integrity sha512-YlYWkkHP9fbwaFRZQRXgDi3mXZShslVmmo+FVK3kHLUELHHEYrCmL1x6IUjC7wLS6VuJSAFXRQS/DxdsC4xL1A==
dependencies:
chokidar ">=3.0.0 <4.0.0"
immutable "^4.0.0"
source-map-js ">=0.6.2 <2.0.0"
sax@1.2.1, sax@>=0.6.0:
version "1.2.1"
@ -11495,7 +11502,7 @@ source-list-map@^2.0.0:
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
integrity sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==
source-map-js@^1.0.1:
"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==