summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-20 09:14:31 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-20 09:14:31 +0000
commitb762fdffd054da31601d4e9f8dbd35ff9d198b59 (patch)
treec989c972883e90855d54e8189154ed084f0f0fa6
parent53699b1598e3d134364a4783a1b0857b131da068 (diff)
downloadgitlab-ce-b762fdffd054da31601d4e9f8dbd35ff9d198b59.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/blob/openapi/index.js13
-rw-r--r--app/assets/javascripts/lib/swagger.js9
-rw-r--r--app/assets/stylesheets/page_bundles/oncall_schedules.scss2
-rw-r--r--app/models/clusters/applications/jupyter.rb128
-rw-r--r--app/models/clusters/cluster.rb2
-rw-r--r--app/services/protected_branches/cache_service.rb1
-rw-r--r--db/docs/clusters_applications_jupyter.yml2
-rw-r--r--doc/administration/monitoring/prometheus/gitlab_metrics.md6
-rw-r--r--doc/development/i18n/proofreader.md1
-rw-r--r--lib/gitlab/cache/client.rb3
-rw-r--r--lib/gitlab/cache/metadata.rb5
-rw-r--r--lib/gitlab/cache/metrics.rb1
-rw-r--r--locale/gitlab.pot3
-rw-r--r--spec/factories/clusters/applications/helm.rb5
-rw-r--r--spec/factories/clusters/clusters.rb1
-rw-r--r--spec/frontend/sidebar/components/severity/sidebar_severity_widget_spec.js (renamed from spec/frontend/sidebar/components/severity/sidebar_severity_spec.js)86
-rw-r--r--spec/lib/gitlab/cache/client_spec.rb3
-rw-r--r--spec/lib/gitlab/cache/metadata_spec.rb13
-rw-r--r--spec/lib/gitlab/cache/metrics_spec.rb5
-rw-r--r--spec/models/clusters/applications/ingress_spec.rb60
-rw-r--r--spec/models/clusters/applications/jupyter_spec.rb130
-rw-r--r--spec/models/clusters/cluster_spec.rb3
22 files changed, 73 insertions, 409 deletions
diff --git a/app/assets/javascripts/blob/openapi/index.js b/app/assets/javascripts/blob/openapi/index.js
index d81aa05c44e..94ae281cada 100644
--- a/app/assets/javascripts/blob/openapi/index.js
+++ b/app/assets/javascripts/blob/openapi/index.js
@@ -1,12 +1,21 @@
import { setAttributes } from '~/lib/utils/dom_utils';
import axios from '~/lib/utils/axios_utils';
-import { getBaseURL, relativePathToAbsolute, joinPaths } from '~/lib/utils/url_utility';
+import {
+ getBaseURL,
+ relativePathToAbsolute,
+ joinPaths,
+ setUrlParams,
+} from '~/lib/utils/url_utility';
const SANDBOX_FRAME_PATH = '/-/sandbox/swagger';
const getSandboxFrameSrc = () => {
const path = joinPaths(gon.relative_url_root || '', SANDBOX_FRAME_PATH);
- return relativePathToAbsolute(path, getBaseURL());
+ const absoluteUrl = relativePathToAbsolute(path, getBaseURL());
+ if (window.gon?.relative_url_root) {
+ return setUrlParams({ relativeRootPath: window.gon.relative_url_root }, absoluteUrl);
+ }
+ return absoluteUrl;
};
const createSandbox = () => {
diff --git a/app/assets/javascripts/lib/swagger.js b/app/assets/javascripts/lib/swagger.js
index ed646176604..fcdab18c623 100644
--- a/app/assets/javascripts/lib/swagger.js
+++ b/app/assets/javascripts/lib/swagger.js
@@ -1,6 +1,13 @@
import { SwaggerUIBundle } from 'swagger-ui-dist';
import { safeLoad } from 'js-yaml';
import { isObject } from '~/lib/utils/type_utility';
+import { getParameterByName } from '~/lib/utils/url_utility';
+import { resetServiceWorkersPublicPath } from '~/lib/utils/webpack';
+
+const resetWebpackPublicPath = () => {
+ window.gon = { relative_url_root: getParameterByName('relativeRootPath') };
+ resetServiceWorkersPublicPath();
+};
const renderSwaggerUI = (value) => {
/* SwaggerUIBundle accepts openapi definition
@@ -12,6 +19,8 @@ const renderSwaggerUI = (value) => {
spec = safeLoad(spec, { json: true });
}
+ resetWebpackPublicPath();
+
Promise.all([import(/* webpackChunkName: 'openapi' */ 'swagger-ui-dist/swagger-ui.css')])
.then(() => {
SwaggerUIBundle({
diff --git a/app/assets/stylesheets/page_bundles/oncall_schedules.scss b/app/assets/stylesheets/page_bundles/oncall_schedules.scss
index f08d6e3ca95..d16ce26a15b 100644
--- a/app/assets/stylesheets/page_bundles/oncall_schedules.scss
+++ b/app/assets/stylesheets/page_bundles/oncall_schedules.scss
@@ -73,7 +73,6 @@ $column-right-gradient: linear-gradient(to right, $gradient-dark-gray 0%, $gradi
@include gl-float-left;
height: $header-item-height;
border-bottom: $border-style;
- background-color: var(--white, $white);
}
.timeline-header-blank {
@@ -159,7 +158,6 @@ $column-right-gradient: linear-gradient(to right, $gradient-dark-gray 0%, $gradi
@include gl-left-0;
width: $details-cell-width;
@include gl-font-base;
- background-color: var(--white, $white);
z-index: 10;
}
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb
deleted file mode 100644
index 9c0e90d59ed..00000000000
--- a/app/models/clusters/applications/jupyter.rb
+++ /dev/null
@@ -1,128 +0,0 @@
-# frozen_string_literal: true
-
-require 'securerandom'
-
-module Clusters
- module Applications
- # DEPRECATED for removal in %14.0
- # See https://gitlab.com/groups/gitlab-org/-/epics/4280
- class Jupyter < ApplicationRecord
- VERSION = '0.9.0'
-
- self.table_name = 'clusters_applications_jupyter'
-
- include ::Clusters::Concerns::ApplicationCore
- include ::Clusters::Concerns::ApplicationStatus
- include ::Clusters::Concerns::ApplicationVersion
- include ::Clusters::Concerns::ApplicationData
-
- belongs_to :oauth_application, class_name: 'Doorkeeper::Application'
-
- attribute :version, default: VERSION
-
- def set_initial_status
- return unless not_installable?
- return unless cluster&.application_ingress_available?
-
- ingress = cluster.application_ingress
- self.status = status_states[:installable] if ingress.external_ip_or_hostname?
- end
-
- def chart
- "#{name}/jupyterhub"
- end
-
- def repository
- 'https://jupyterhub.github.io/helm-chart/'
- end
-
- def values
- content_values.to_yaml
- end
-
- def install_command
- helm_command_module::InstallCommand.new(
- name: name,
- version: VERSION,
- rbac: cluster.platform_kubernetes_rbac?,
- chart: chart,
- files: files,
- repository: repository
- )
- end
-
- def callback_url
- "http://#{hostname}/hub/oauth_callback"
- end
-
- def oauth_scopes
- 'api read_repository write_repository'
- end
-
- private
-
- def specification
- {
- "ingress" => {
- "hosts" => [hostname],
- "tls" => [{
- "hosts" => [hostname],
- "secretName" => "jupyter-cert"
- }]
- },
- "hub" => {
- "extraEnv" => {
- "GITLAB_HOST" => gitlab_url
- },
- "cookieSecret" => cookie_secret
- },
- "proxy" => {
- "secretToken" => secret_token
- },
- "auth" => {
- "state" => {
- "cryptoKey" => crypto_key
- },
- "gitlab" => {
- "clientId" => oauth_application.uid,
- "clientSecret" => oauth_application.secret,
- "callbackUrl" => callback_url,
- "gitlabProjectIdWhitelist" => cluster.projects.ids,
- "gitlabGroupWhitelist" => cluster.groups.map(&:to_param)
- }
- },
- "singleuser" => {
- "extraEnv" => {
- "GITLAB_CLUSTER_ID" => cluster.id.to_s,
- "GITLAB_HOST" => gitlab_host
- }
- }
- }
- end
-
- def crypto_key
- @crypto_key ||= SecureRandom.hex(32)
- end
-
- def gitlab_url
- Gitlab.config.gitlab.url
- end
-
- def gitlab_host
- Gitlab.config.gitlab.host
- end
-
- def content_values
- YAML.load_file(chart_values_file).deep_merge!(specification)
- end
-
- def secret_token
- @secret_token ||= SecureRandom.hex(32)
- end
-
- def cookie_secret
- @cookie_secret ||= SecureRandom.hex(32)
- end
- end
- end
-end
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 5cd11265808..980bbb5ce0a 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -15,7 +15,6 @@ module Clusters
Clusters::Applications::Helm.application_name => Clusters::Applications::Helm,
Clusters::Applications::Ingress.application_name => Clusters::Applications::Ingress,
Clusters::Applications::Runner.application_name => Clusters::Applications::Runner,
- Clusters::Applications::Jupyter.application_name => Clusters::Applications::Jupyter,
Clusters::Applications::Knative.application_name => Clusters::Applications::Knative
}.freeze
DEFAULT_ENVIRONMENT = '*'
@@ -55,7 +54,6 @@ module Clusters
has_one_cluster_application :helm
has_one_cluster_application :ingress
has_one_cluster_application :runner
- has_one_cluster_application :jupyter
has_one_cluster_application :knative
has_many :kubernetes_namespaces
diff --git a/app/services/protected_branches/cache_service.rb b/app/services/protected_branches/cache_service.rb
index ac02bf25617..2f0d3945014 100644
--- a/app/services/protected_branches/cache_service.rb
+++ b/app/services/protected_branches/cache_service.rb
@@ -87,7 +87,6 @@ module ProtectedBranches
def cache_metadata
Gitlab::Cache::Metadata.new(
- caller_id: Gitlab::ApplicationContext.current_context_attribute(:caller_id),
cache_identifier: "#{self.class}#fetch",
feature_category: :source_code_management,
backing_resource: :cpu
diff --git a/db/docs/clusters_applications_jupyter.yml b/db/docs/clusters_applications_jupyter.yml
index b15b889779b..59a28cd0469 100644
--- a/db/docs/clusters_applications_jupyter.yml
+++ b/db/docs/clusters_applications_jupyter.yml
@@ -1,7 +1,5 @@
---
table_name: clusters_applications_jupyter
-classes:
-- Clusters::Applications::Jupyter
feature_categories:
- kubernetes_management
description: "(Deprecated) A GitLab managed Jupyter installation in a Kubernetes cluster"
diff --git a/doc/administration/monitoring/prometheus/gitlab_metrics.md b/doc/administration/monitoring/prometheus/gitlab_metrics.md
index c21c92a3d63..085510738f1 100644
--- a/doc/administration/monitoring/prometheus/gitlab_metrics.md
+++ b/doc/administration/monitoring/prometheus/gitlab_metrics.md
@@ -30,6 +30,8 @@ For enabling and viewing metrics from Sidekiq nodes, see [Sidekiq metrics](#side
## Metrics available
+> `caller_id` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/392622) from `redis_hit_miss_operations_total` and `redis_cache_generation_duration_seconds` in GitLab 15.11.
+
The following metrics are available:
| Metric | Type | Since | Description | Labels |
@@ -151,8 +153,8 @@ The following metrics are available:
| `gitlab_ci_build_trace_errors_total` | Counter | 14.4 | Total amount of different error types on a build trace | `error_reason` |
| `gitlab_presentable_object_cacheless_render_real_duration_seconds` | Histogram | 15.3 | Duration of real time spent caching and representing specific web request objects | `controller`, `action` |
| `cached_object_operations_total` | Counter | 15.3 | Total number of objects cached for specific web requests | `controller`, `action` |
-| `redis_hit_miss_operations_total` | Counter | 15.6 | Total number of Redis cache hits and misses | `cache_hit`, `caller_id`, `cache_identifier`, `feature_category`, `backing_resource` |
-| `redis_cache_generation_duration_seconds` | Histogram | 15.6 | Time to generate Redis cache | `cache_hit`, `caller_id`, `cache_identifier`, `feature_category`, `backing_resource` |
+| `redis_hit_miss_operations_total` | Counter | 15.6 | Total number of Redis cache hits and misses | `cache_hit`, `cache_identifier`, `feature_category`, `backing_resource` |
+| `redis_cache_generation_duration_seconds` | Histogram | 15.6 | Time to generate Redis cache | `cache_hit`, `cache_identifier`, `feature_category`, `backing_resource` |
| `gitlab_diffs_reorder_real_duration_seconds` | Histogram | 15.8 | Duration in seconds spend on reordering of diff files on diffs batch request | `controller`, `action` |
| `gitlab_diffs_collection_real_duration_seconds` | Histogram | 15.8 | Duration in seconds spent on querying merge request diff files on diffs batch request | `controller`, `action` |
| `gitlab_diffs_comparison_real_duration_seconds` | Histogram | 15.8 | Duration in seconds spent on getting comparison data on diffs batch request | `controller`, `action` |
diff --git a/doc/development/i18n/proofreader.md b/doc/development/i18n/proofreader.md
index 1957662317a..419f889240c 100644
--- a/doc/development/i18n/proofreader.md
+++ b/doc/development/i18n/proofreader.md
@@ -126,6 +126,7 @@ are very appreciative of the work done by translators and proofreaders!
- Proofreaders needed.
- Spanish
- Pedro Garcia - [GitLab](https://gitlab.com/pedgarrod), [Crowdin](https://crowdin.com/profile/breaking_pitt)
+ - David Elizondo - [GitLab](https://gitlab.com/daelmo), [Crowdin](https://crowdin.com/profile/daelmo)
- Swedish
- Johannes Nilsson - [GitLab](https://gitlab.com/nlssn), [Crowdin](https://crowdin.com/profile/nlssn)
- Turkish
diff --git a/lib/gitlab/cache/client.rb b/lib/gitlab/cache/client.rb
index ac710ee0adf..37d6cac8d43 100644
--- a/lib/gitlab/cache/client.rb
+++ b/lib/gitlab/cache/client.rb
@@ -11,17 +11,14 @@ module Gitlab
# @param cache_identifier [String] defines the location of the cache definition
# Example: "ProtectedBranches::CacheService#fetch"
# @param feature_category [Symbol] name of the feature category (from config/feature_categories.yml)
- # @param caller_id [String] caller id from labkit context
# @param backing_resource [Symbol] most affected resource by cache generation (full list: VALID_BACKING_RESOURCES)
# @return [Gitlab::Cache::Client]
def self.build_with_metadata(
cache_identifier:,
feature_category:,
- caller_id: Gitlab::ApplicationContext.current_context_attribute(:caller_id),
backing_resource: DEFAULT_BACKING_RESOURCE
)
new(Metadata.new(
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource
diff --git a/lib/gitlab/cache/metadata.rb b/lib/gitlab/cache/metadata.rb
index 224f215ef82..de35b332300 100644
--- a/lib/gitlab/cache/metadata.rb
+++ b/lib/gitlab/cache/metadata.rb
@@ -9,22 +9,19 @@ module Gitlab
# @param cache_identifier [String] defines the location of the cache definition
# Example: "ProtectedBranches::CacheService#fetch"
# @param feature_category [Symbol] name of the feature category (from config/feature_categories.yml)
- # @param caller_id [String] caller id from labkit context
# @param backing_resource [Symbol] most affected resource by cache generation (full list: VALID_BACKING_RESOURCES)
# @return [Gitlab::Cache::Metadata]
def initialize(
cache_identifier:,
feature_category:,
- caller_id: Gitlab::ApplicationContext.current_context_attribute(:caller_id),
backing_resource: Client::DEFAULT_BACKING_RESOURCE
)
@cache_identifier = cache_identifier
@feature_category = Gitlab::FeatureCategories.default.get!(feature_category)
- @caller_id = caller_id
@backing_resource = fetch_backing_resource!(backing_resource)
end
- attr_reader :caller_id, :cache_identifier, :feature_category, :backing_resource
+ attr_reader :cache_identifier, :feature_category, :backing_resource
private
diff --git a/lib/gitlab/cache/metrics.rb b/lib/gitlab/cache/metrics.rb
index 00d4e6e4d4e..d9c80f076b9 100644
--- a/lib/gitlab/cache/metrics.rb
+++ b/lib/gitlab/cache/metrics.rb
@@ -58,7 +58,6 @@ module Gitlab
def labels
@labels ||= {
- caller_id: cache_metadata.caller_id,
cache_identifier: cache_metadata.cache_identifier,
feature_category: cache_metadata.feature_category,
backing_resource: cache_metadata.backing_resource
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 97b4b0e614e..ca757c57f3b 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -29769,9 +29769,6 @@ msgstr ""
msgid "OnCallSchedules|Add a rotation"
msgstr ""
-msgid "OnCallSchedules|Add a schedule"
-msgstr ""
-
msgid "OnCallSchedules|Add an additional schedule to your project"
msgstr ""
diff --git a/spec/factories/clusters/applications/helm.rb b/spec/factories/clusters/applications/helm.rb
index 99110a9b841..8b623a54e27 100644
--- a/spec/factories/clusters/applications/helm.rb
+++ b/spec/factories/clusters/applications/helm.rb
@@ -106,10 +106,5 @@ FactoryBot.define do
hostname { 'example.com' }
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end
-
- factory :clusters_applications_jupyter, class: 'Clusters::Applications::Jupyter' do
- oauth_application factory: :oauth_application
- cluster factory: %i(cluster with_installed_helm provided_by_gcp project)
- end
end
end
diff --git a/spec/factories/clusters/clusters.rb b/spec/factories/clusters/clusters.rb
index d92ee6dcbe7..6518d74a5d2 100644
--- a/spec/factories/clusters/clusters.rb
+++ b/spec/factories/clusters/clusters.rb
@@ -94,7 +94,6 @@ FactoryBot.define do
application_helm factory: %i(clusters_applications_helm installed)
application_ingress factory: %i(clusters_applications_ingress installed)
application_runner factory: %i(clusters_applications_runner installed)
- application_jupyter factory: %i(clusters_applications_jupyter installed)
application_knative factory: %i(clusters_applications_knative installed)
end
diff --git a/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js b/spec/frontend/sidebar/components/severity/sidebar_severity_widget_spec.js
index 8a27e82093d..13b3c5eef05 100644
--- a/spec/frontend/sidebar/components/severity/sidebar_severity_spec.js
+++ b/spec/frontend/sidebar/components/severity/sidebar_severity_widget_spec.js
@@ -1,5 +1,7 @@
import { GlDropdown, GlDropdownItem, GlLoadingIcon, GlTooltip, GlSprintf } from '@gitlab/ui';
-import { nextTick } from 'vue';
+import Vue, { nextTick } from 'vue';
+import VueApollo from 'vue-apollo';
+import createMockApollo from 'helpers/mock_apollo_helper';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises';
import { createAlert } from '~/alert';
@@ -11,15 +13,18 @@ import SidebarSeverityWidget from '~/sidebar/components/severity/sidebar_severit
jest.mock('~/alert');
-describe('SidebarSeverity', () => {
+Vue.use(VueApollo);
+
+describe('SidebarSeverityWidget', () => {
let wrapper;
- let mutate;
+ let mockApollo;
const projectPath = 'gitlab-org/gitlab-test';
const iid = '1';
const severity = 'CRITICAL';
- let canUpdate = true;
- function createComponent(props = {}) {
+ function createComponent({ props, canUpdate = true, mutationMock } = {}) {
+ mockApollo = createMockApollo([[updateIssuableSeverity, mutationMock]]);
+
const propsData = {
projectPath,
iid,
@@ -27,102 +32,101 @@ describe('SidebarSeverity', () => {
initialSeverity: severity,
...props,
};
- mutate = jest.fn();
+
wrapper = mountExtended(SidebarSeverityWidget, {
propsData,
provide: {
canUpdate,
},
- mocks: {
- $apollo: {
- mutate,
- },
- },
+ apolloProvider: mockApollo,
stubs: {
GlSprintf,
},
});
}
- beforeEach(() => {
- createComponent();
+ afterEach(() => {
+ mockApollo = null;
});
const findSeverityToken = () => wrapper.findAllComponents(SeverityToken);
const findEditBtn = () => wrapper.findByTestId('edit-button');
const findDropdown = () => wrapper.findComponent(GlDropdown);
- const findCriticalSeverityDropdownItem = () => wrapper.findComponent(GlDropdownItem);
+ const findCriticalSeverityDropdownItem = () => wrapper.findComponent(GlDropdownItem); // First dropdown item is critical severity
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findTooltip = () => wrapper.findComponent(GlTooltip);
const findCollapsedSeverity = () => wrapper.findComponent({ ref: 'severity' });
describe('Severity widget', () => {
it('renders severity dropdown and token', () => {
+ createComponent();
+
expect(findSeverityToken().exists()).toBe(true);
expect(findDropdown().exists()).toBe(true);
});
describe('edit button', () => {
it('is rendered when `canUpdate` provided as `true`', () => {
+ createComponent();
+
expect(findEditBtn().exists()).toBe(true);
});
it('is NOT rendered when `canUpdate` provided as `false`', () => {
- canUpdate = false;
- createComponent();
+ createComponent({ canUpdate: false });
+
expect(findEditBtn().exists()).toBe(false);
});
});
});
describe('Update severity', () => {
- it('calls `$apollo.mutate` with `updateIssuableSeverity`', () => {
- jest
- .spyOn(wrapper.vm.$apollo, 'mutate')
- .mockResolvedValueOnce({ data: { issueSetSeverity: { issue: { severity } } } });
+ it('calls mutate with `updateIssuableSeverity`', async () => {
+ const mutationMock = jest.fn().mockResolvedValue({
+ data: { issueSetSeverity: { issue: { severity } } },
+ });
+ createComponent({ mutationMock });
findCriticalSeverityDropdownItem().vm.$emit('click');
- expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledWith({
- mutation: updateIssuableSeverity,
- variables: {
- iid,
- projectPath,
- severity,
- },
+
+ expect(mutationMock).toHaveBeenCalledWith({
+ iid,
+ projectPath,
+ severity,
});
});
it('shows error alert when severity update fails', async () => {
- const errorMsg = 'Something went wrong';
- jest.spyOn(wrapper.vm.$apollo, 'mutate').mockRejectedValueOnce(errorMsg);
- findCriticalSeverityDropdownItem().vm.$emit('click');
+ const mutationMock = jest.fn().mockRejectedValue('Something went wrong');
+ createComponent({ mutationMock });
+ findCriticalSeverityDropdownItem().vm.$emit('click');
await waitForPromises();
expect(createAlert).toHaveBeenCalled();
});
it('shows loading icon while updating', async () => {
- let resolvePromise;
- wrapper.vm.$apollo.mutate = jest.fn(
- () =>
- new Promise((resolve) => {
- resolvePromise = resolve;
- }),
- );
- findCriticalSeverityDropdownItem().vm.$emit('click');
+ const mutationMock = jest.fn().mockRejectedValue({});
+ createComponent({ mutationMock });
+ findCriticalSeverityDropdownItem().vm.$emit('click');
await nextTick();
+
expect(findLoadingIcon().exists()).toBe(true);
- resolvePromise();
await waitForPromises();
+
expect(findLoadingIcon().exists()).toBe(false);
});
});
describe('Switch between collapsed/expanded view of the sidebar', () => {
describe('collapsed', () => {
+ beforeEach(() => {
+ createComponent({ canUpdate: false });
+ });
+
it('should have collapsed icon class', () => {
expect(findCollapsedSeverity().classes('sidebar-collapsed-icon')).toBe(true);
});
@@ -136,17 +140,19 @@ describe('SidebarSeverity', () => {
describe('expanded', () => {
it('toggles dropdown with edit button', async () => {
- canUpdate = true;
createComponent();
await nextTick();
+
expect(findDropdown().isVisible()).toBe(false);
findEditBtn().vm.$emit('click');
await nextTick();
+
expect(findDropdown().isVisible()).toBe(true);
findEditBtn().vm.$emit('click');
await nextTick();
+
expect(findDropdown().isVisible()).toBe(false);
});
});
diff --git a/spec/lib/gitlab/cache/client_spec.rb b/spec/lib/gitlab/cache/client_spec.rb
index ec22fcdee7e..638fed1a905 100644
--- a/spec/lib/gitlab/cache/client_spec.rb
+++ b/spec/lib/gitlab/cache/client_spec.rb
@@ -8,14 +8,12 @@ RSpec.describe Gitlab::Cache::Client, feature_category: :source_code_management
let(:backend) { Rails.cache }
let(:metadata) do
Gitlab::Cache::Metadata.new(
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource
)
end
- let(:caller_id) { 'caller-id' }
let(:cache_identifier) { 'MyClass#cache' }
let(:feature_category) { :source_code_management }
let(:backing_resource) { :cpu }
@@ -32,7 +30,6 @@ RSpec.describe Gitlab::Cache::Client, feature_category: :source_code_management
describe '.build_with_metadata' do
it 'builds a cache client with metrics support' do
attributes = {
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource
diff --git a/spec/lib/gitlab/cache/metadata_spec.rb b/spec/lib/gitlab/cache/metadata_spec.rb
index 2e8af7a9c44..d2b79fb8b08 100644
--- a/spec/lib/gitlab/cache/metadata_spec.rb
+++ b/spec/lib/gitlab/cache/metadata_spec.rb
@@ -5,24 +5,18 @@ require 'spec_helper'
RSpec.describe Gitlab::Cache::Metadata, feature_category: :source_code_management do
subject(:attributes) do
described_class.new(
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource
)
end
- let(:caller_id) { 'caller-id' }
let(:cache_identifier) { 'ApplicationController#show' }
let(:feature_category) { :source_code_management }
let(:backing_resource) { :unknown }
describe '#initialize' do
context 'when optional arguments are not set' do
- before do
- Gitlab::ApplicationContext.push(caller_id: 'context-id')
- end
-
it 'sets default value for them' do
attributes = described_class.new(
cache_identifier: cache_identifier,
@@ -30,7 +24,6 @@ RSpec.describe Gitlab::Cache::Metadata, feature_category: :source_code_managemen
)
expect(attributes.backing_resource).to eq(:unknown)
- expect(attributes.caller_id).to eq('context-id')
end
end
@@ -68,12 +61,6 @@ RSpec.describe Gitlab::Cache::Metadata, feature_category: :source_code_managemen
end
end
- describe '#caller_id' do
- subject { attributes.caller_id }
-
- it { is_expected.to eq caller_id }
- end
-
describe '#cache_identifier' do
subject { attributes.cache_identifier }
diff --git a/spec/lib/gitlab/cache/metrics_spec.rb b/spec/lib/gitlab/cache/metrics_spec.rb
index 24b274f4209..76ec0dbfa0b 100644
--- a/spec/lib/gitlab/cache/metrics_spec.rb
+++ b/spec/lib/gitlab/cache/metrics_spec.rb
@@ -7,14 +7,12 @@ RSpec.describe Gitlab::Cache::Metrics do
let(:metadata) do
Gitlab::Cache::Metadata.new(
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource
)
end
- let(:caller_id) { 'caller-id' }
let(:cache_identifier) { 'ApplicationController#show' }
let(:feature_category) { :source_code_management }
let(:backing_resource) { :unknown }
@@ -37,7 +35,6 @@ RSpec.describe Gitlab::Cache::Metrics do
.to receive(:increment)
.with(
{
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource,
@@ -57,7 +54,6 @@ RSpec.describe Gitlab::Cache::Metrics do
.to receive(:increment)
.with(
{
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource,
@@ -86,7 +82,6 @@ RSpec.describe Gitlab::Cache::Metrics do
:redis_cache_generation_duration_seconds,
'Duration of Redis cache generation',
{
- caller_id: caller_id,
cache_identifier: cache_identifier,
feature_category: feature_category,
backing_resource: backing_resource
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb
index 2be59e5f515..99be2ed8ee8 100644
--- a/spec/models/clusters/applications/ingress_spec.rb
+++ b/spec/models/clusters/applications/ingress_spec.rb
@@ -23,66 +23,6 @@ RSpec.describe Clusters::Applications::Ingress do
it { expect(subject.version).to eq(described_class::VERSION) }
end
- describe '#can_uninstall?' do
- subject { ingress.can_uninstall? }
-
- context 'with jupyter installed' do
- before do
- create(:clusters_applications_jupyter, :installed, cluster: ingress.cluster)
- end
-
- it 'returns false if external_ip_or_hostname? is true' do
- ingress.external_ip = 'IP'
-
- is_expected.to be_falsey
- end
-
- it 'returns false if external_ip_or_hostname? is false' do
- is_expected.to be_falsey
- end
- end
-
- context 'with jupyter installable' do
- before do
- create(:clusters_applications_jupyter, :installable, cluster: ingress.cluster)
- end
-
- it 'returns true if external_ip_or_hostname? is true' do
- ingress.external_ip = 'IP'
-
- is_expected.to be_truthy
- end
-
- it 'returns false if external_ip_or_hostname? is false' do
- is_expected.to be_falsey
- end
- end
-
- context 'with jupyter nil' do
- it 'returns false if external_ip_or_hostname? is false' do
- is_expected.to be_falsey
- end
-
- context 'if external_ip_or_hostname? is true' do
- context 'with IP' do
- before do
- ingress.external_ip = 'IP'
- end
-
- it { is_expected.to be_truthy }
- end
-
- context 'with hostname' do
- before do
- ingress.external_hostname = 'example.com'
- end
-
- it { is_expected.to be_truthy }
- end
- end
- end
- end
-
describe '#make_installed!' do
before do
application.make_installed!
diff --git a/spec/models/clusters/applications/jupyter_spec.rb b/spec/models/clusters/applications/jupyter_spec.rb
deleted file mode 100644
index 9336d2352f8..00000000000
--- a/spec/models/clusters/applications/jupyter_spec.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Clusters::Applications::Jupyter do
- include_examples 'cluster application core specs', :clusters_applications_jupyter
- include_examples 'cluster application status specs', :clusters_applications_jupyter
- include_examples 'cluster application version specs', :clusters_applications_jupyter
- include_examples 'cluster application helm specs', :clusters_applications_jupyter
-
- it { is_expected.to belong_to(:oauth_application) }
-
- describe 'default values' do
- it { expect(subject.version).to eq(described_class::VERSION) }
- end
-
- describe '#can_uninstall?' do
- let(:ingress) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') }
- let(:jupyter) { create(:clusters_applications_jupyter, cluster: ingress.cluster) }
-
- subject { jupyter.can_uninstall? }
-
- it { is_expected.to be_truthy }
- end
-
- describe '#set_initial_status' do
- before do
- jupyter.set_initial_status
- end
-
- context 'when ingress is not installed' do
- let(:cluster) { create(:cluster, :provided_by_gcp) }
- let(:jupyter) { create(:clusters_applications_jupyter, cluster: cluster) }
-
- it { expect(jupyter).to be_not_installable }
- end
-
- context 'when ingress is installed and external_ip is assigned' do
- let(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
- let(:jupyter) { create(:clusters_applications_jupyter, cluster: ingress.cluster) }
-
- it { expect(jupyter).to be_installable }
- end
-
- context 'when ingress is installed and external_hostname is assigned' do
- let(:ingress) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') }
- let(:jupyter) { create(:clusters_applications_jupyter, cluster: ingress.cluster) }
-
- it { expect(jupyter).to be_installable }
- end
- end
-
- describe '#install_command' do
- let!(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
- let!(:jupyter) { create(:clusters_applications_jupyter, cluster: ingress.cluster) }
-
- subject { jupyter.install_command }
-
- it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) }
-
- it 'is initialized with 4 arguments' do
- expect(subject.name).to eq('jupyter')
- expect(subject.chart).to eq('jupyter/jupyterhub')
- expect(subject.version).to eq('0.9.0')
-
- expect(subject).to be_rbac
- expect(subject.repository).to eq('https://jupyterhub.github.io/helm-chart/')
- expect(subject.files).to eq(jupyter.files)
- end
-
- context 'on a non rbac enabled cluster' do
- before do
- jupyter.cluster.platform_kubernetes.abac!
- end
-
- it { is_expected.not_to be_rbac }
- end
-
- context 'application failed to install previously' do
- let(:jupyter) { create(:clusters_applications_jupyter, :errored, version: '0.0.1') }
-
- it 'is initialized with the locked version' do
- expect(subject.version).to eq('0.9.0')
- end
- end
- end
-
- describe '#files' do
- let(:cluster) { create(:cluster, :with_installed_helm, :provided_by_gcp, :project) }
- let(:application) { create(:clusters_applications_jupyter, cluster: cluster) }
- let(:values) { subject[:'values.yaml'] }
-
- subject { application.files }
-
- context 'when cluster belongs to a project' do
- it 'includes valid values' do
- expect(values).to include('ingress')
- expect(values).to include('hub')
- expect(values).to include('proxy')
- expect(values).to include('auth')
- expect(values).to include('singleuser')
- expect(values).to match(/clientId: '?#{application.oauth_application.uid}/)
- expect(values).to match(/callbackUrl: '?#{application.callback_url}/)
- expect(values).to include("gitlabProjectIdWhitelist:\n - #{application.cluster.project.id}")
- expect(values).to include("c.GitLabOAuthenticator.scope = ['api read_repository write_repository']")
- expect(values).to match(/GITLAB_HOST: '?#{Gitlab.config.gitlab.host}/)
- expect(values).to match(/GITLAB_CLUSTER_ID: '?#{application.cluster.id}/)
- end
- end
-
- context 'when cluster belongs to a group' do
- let(:group) { create(:group) }
- let(:cluster) { create(:cluster, :with_installed_helm, :provided_by_gcp, :group, groups: [group]) }
-
- it 'includes valid values' do
- expect(values).to include('ingress')
- expect(values).to include('hub')
- expect(values).to include('proxy')
- expect(values).to include('auth')
- expect(values).to include('singleuser')
- expect(values).to match(/clientId: '?#{application.oauth_application.uid}/)
- expect(values).to match(/callbackUrl: '?#{application.callback_url}/)
- expect(values).to include("gitlabGroupWhitelist:\n - #{group.to_param}")
- expect(values).to include("c.GitLabOAuthenticator.scope = ['api read_repository write_repository']")
- expect(values).to match(/GITLAB_HOST: '?#{Gitlab.config.gitlab.host}/)
- expect(values).to match(/GITLAB_CLUSTER_ID: '?#{application.cluster.id}/)
- end
- end
- end
-end
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 2d46714eb22..1db5eb8ef4b 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -714,11 +714,10 @@ feature_category: :kubernetes_management do
let!(:helm) { create(:clusters_applications_helm, cluster: cluster) }
let!(:ingress) { create(:clusters_applications_ingress, cluster: cluster) }
let!(:runner) { create(:clusters_applications_runner, cluster: cluster) }
- let!(:jupyter) { create(:clusters_applications_jupyter, cluster: cluster) }
let!(:knative) { create(:clusters_applications_knative, cluster: cluster) }
it 'returns a list of created applications' do
- is_expected.to contain_exactly(helm, ingress, runner, jupyter, knative)
+ is_expected.to contain_exactly(helm, ingress, runner, knative)
end
end