Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-13 18:08:23 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-13 18:08:23 +0300
commit868e4e69bba7d3ddc2bf4899ee45d6c377a8e536 (patch)
tree921098180de1fbf8e58cfaeade0d0999177b0ce6 /spec/lib/gitlab
parent41e8b05e8d06f4b13a984e4a3ad26e9a48294543 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/git_access_design_spec.rb9
-rw-r--r--spec/lib/gitlab/kubernetes/helm/parsers/list_v2_spec.rb86
-rw-r--r--spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb16
3 files changed, 101 insertions, 10 deletions
diff --git a/spec/lib/gitlab/git_access_design_spec.rb b/spec/lib/gitlab/git_access_design_spec.rb
index b09afc67c90..d816608f7e5 100644
--- a/spec/lib/gitlab/git_access_design_spec.rb
+++ b/spec/lib/gitlab/git_access_design_spec.rb
@@ -21,16 +21,7 @@ describe Gitlab::GitAccessDesign do
end
context 'when the user is allowed to manage designs' do
- # TODO This test is being temporarily skipped unless run in EE,
- # as we are in the process of moving Design Management to FOSS in 13.0
- # in steps. In the current step the policies have not yet been moved
- # which means that although the `GitAccessDesign` class has moved, the
- # user will always be denied access in FOSS.
- #
- # See https://gitlab.com/gitlab-org/gitlab/-/issues/212566#note_327724283.
it do
- skip 'See https://gitlab.com/gitlab-org/gitlab/-/issues/212566#note_327724283' unless Gitlab.ee?
-
is_expected.to be_a(::Gitlab::GitAccessResult::Success)
end
end
diff --git a/spec/lib/gitlab/kubernetes/helm/parsers/list_v2_spec.rb b/spec/lib/gitlab/kubernetes/helm/parsers/list_v2_spec.rb
new file mode 100644
index 00000000000..b4b1d8bec51
--- /dev/null
+++ b/spec/lib/gitlab/kubernetes/helm/parsers/list_v2_spec.rb
@@ -0,0 +1,86 @@
+# frozen_string_literal: true
+
+require 'fast_spec_helper'
+
+describe Gitlab::Kubernetes::Helm::Parsers::ListV2 do
+ let(:valid_file_contents) do
+ <<~EOF
+ {
+ "Next": "",
+ "Releases": [
+ {
+ "Name": "certmanager",
+ "Revision": 2,
+ "Updated": "Sun Mar 29 06:55:42 2020",
+ "Status": "DEPLOYED",
+ "Chart": "cert-manager-v0.10.1",
+ "AppVersion": "v0.10.1",
+ "Namespace": "gitlab-managed-apps"
+ },
+ {
+ "Name": "certmanager-crds",
+ "Revision": 2,
+ "Updated": "Sun Mar 29 06:55:32 2020",
+ "Status": "DEPLOYED",
+ "Chart": "cert-manager-crds-v0.2.0",
+ "AppVersion": "release-0.10",
+ "Namespace": "gitlab-managed-apps"
+ },
+ {
+ "Name": "certmanager-issuer",
+ "Revision": 1,
+ "Updated": "Tue Feb 18 10:04:04 2020",
+ "Status": "FAILED",
+ "Chart": "cert-manager-issuer-v0.1.0",
+ "AppVersion": "",
+ "Namespace": "gitlab-managed-apps"
+ },
+ {
+ "Name": "runner",
+ "Revision": 2,
+ "Updated": "Sun Mar 29 07:01:01 2020",
+ "Status": "DEPLOYED",
+ "Chart": "gitlab-runner-0.14.0",
+ "AppVersion": "12.8.0",
+ "Namespace": "gitlab-managed-apps"
+ }
+ ]
+ }
+ EOF
+ end
+
+ describe '#initialize' do
+ it 'initializes without error' do
+ expect do
+ described_class.new(valid_file_contents)
+ end.not_to raise_error
+ end
+
+ it 'raises an error on invalid JSON' do
+ expect do
+ described_class.new('')
+ end.to raise_error(described_class::ParserError, 'A JSON text must at least contain two octets!')
+ end
+ end
+
+ describe '#releases' do
+ subject(:list_v2) { described_class.new(valid_file_contents) }
+
+ it 'returns list of releases' do
+ expect(list_v2.releases).to match([
+ a_hash_including('Name' => 'certmanager', 'Status' => 'DEPLOYED'),
+ a_hash_including('Name' => 'certmanager-crds', 'Status' => 'DEPLOYED'),
+ a_hash_including('Name' => 'certmanager-issuer', 'Status' => 'FAILED'),
+ a_hash_including('Name' => 'runner', 'Status' => 'DEPLOYED')
+ ])
+ end
+
+ context 'empty Releases' do
+ let(:valid_file_contents) { '{}' }
+
+ it 'returns an empty array' do
+ expect(list_v2.releases).to eq([])
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
index a2626f8d680..ead650a27f0 100644
--- a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
+++ b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
@@ -8,7 +8,6 @@ describe Gitlab::Metrics::Samplers::RubySampler do
before do
allow(Gitlab::Metrics::NullMetric).to receive(:instance).and_return(null_metric)
- stub_env('enable_memory_uss_pss', "1")
end
describe '#initialize' do
@@ -37,6 +36,21 @@ describe Gitlab::Metrics::Samplers::RubySampler do
sampler.sample
end
+ context 'when USS+PSS sampling is disabled via environment' do
+ before do
+ stub_env('enable_memory_uss_pss', "0")
+ end
+
+ it 'does not sample USS or PSS' do
+ expect(Gitlab::Metrics::System).not_to receive(:memory_usage_uss_pss)
+
+ expect(sampler.metrics[:process_unique_memory_bytes]).not_to receive(:set)
+ expect(sampler.metrics[:process_proportional_memory_bytes]).not_to receive(:set)
+
+ sampler.sample
+ end
+ end
+
it 'adds a metric containing the amount of open file descriptors' do
expect(Gitlab::Metrics::System).to receive(:file_descriptor_count)
.and_return(4)