summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 15:09:29 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 15:09:29 +0000
commit37ae6b54ba524c438d1b756ce3ca29bbcec4e897 (patch)
treee0cd3b9a5f19daec493de537d3214ac390101462 /spec/lib
parentc74b7b5e4345702a1d59c72d923c3580ef157a59 (diff)
downloadgitlab-ce-37ae6b54ba524c438d1b756ce3ca29bbcec4e897.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml3
-rw-r--r--spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb8
-rw-r--r--spec/lib/gitlab/import_export/project/tree_restorer_spec.rb44
-rw-r--r--spec/lib/gitlab/import_export/relation_tree_restorer_spec.rb8
-rw-r--r--spec/lib/gitlab/kubernetes/kube_client_spec.rb38
5 files changed, 41 insertions, 60 deletions
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 12b8858e30b..fde8ed5c1ce 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -42,6 +42,7 @@ issues:
- user_mentions
- system_note_metadata
- alert_management_alert
+- status_page_published_incident
events:
- author
- project
@@ -638,3 +639,5 @@ epic_issue:
system_note_metadata:
- note
- description_version
+status_page_published_incident:
+- issue
diff --git a/spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb b/spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb
index 40b784fdb87..17d0546a0a7 100644
--- a/spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb
+++ b/spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb
@@ -10,14 +10,6 @@ describe Gitlab::ImportExport::JSON::NdjsonReader do
let(:ndjson_reader) { described_class.new(dir_path) }
let(:importable_path) { 'project' }
- before :all do
- extract_archive('spec/fixtures/lib/gitlab/import_export/light', 'tree.tar.gz')
- end
-
- after :all do
- cleanup_artifacts_from_extract_archive('light')
- end
-
describe '#exist?' do
subject { ndjson_reader.exist? }
diff --git a/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
index 04e8bd05666..ecb1ed08260 100644
--- a/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
+++ b/spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
@@ -44,10 +44,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
end
end
- after(:context) do
- cleanup_artifacts_from_extract_archive('complex')
- end
-
context 'JSON' do
it 'restores models based on JSON' do
expect(@restored_project_json).to be_truthy
@@ -536,10 +532,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect(restored_project_json).to eq(true)
end
- after do
- cleanup_artifacts_from_extract_archive('light')
- end
-
it 'issue system note metadata restored successfully' do
note_content = 'created merge request !1 to address this issue'
note = project.issues.first.notes.select { |n| n.note.match(/#{note_content}/)}.first
@@ -586,10 +578,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect(restored_project_json).to eq(true)
end
- after do
- cleanup_artifacts_from_extract_archive('multi_pipeline_ref_one_external_pr')
- end
-
it_behaves_like 'restores project successfully',
issues: 0,
labels: 0,
@@ -620,10 +608,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
.and_raise(exception)
end
- after do
- cleanup_artifacts_from_extract_archive('light')
- end
-
it 'report post import error' do
expect(restored_project_json).to eq(false)
expect(shared.errors).to include('post_import_error')
@@ -646,10 +630,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect(restored_project_json).to eq(true)
end
- after do
- cleanup_artifacts_from_extract_archive('light')
- end
-
it_behaves_like 'restores project successfully',
issues: 1,
labels: 2,
@@ -678,10 +658,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
setup_reader(reader)
end
- after do
- cleanup_artifacts_from_extract_archive('light')
- end
-
it 'handles string versions of visibility_level' do
# Project needs to be in a group for visibility level comparison
# to happen
@@ -747,10 +723,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect(restored_project_json).to eq(true)
end
- after do
- cleanup_artifacts_from_extract_archive('group')
- end
-
it_behaves_like 'restores project successfully',
issues: 3,
labels: 2,
@@ -784,10 +756,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
setup_reader(reader)
end
- after do
- cleanup_artifacts_from_extract_archive('light')
- end
-
it 'does not import any templated services' do
expect(restored_project_json).to eq(true)
@@ -835,10 +803,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
setup_reader(reader)
end
- after do
- cleanup_artifacts_from_extract_archive('milestone-iid')
- end
-
it 'preserves the project milestone IID' do
expect_any_instance_of(Gitlab::ImportExport::Shared).not_to receive(:error)
@@ -855,10 +819,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
setup_reader(reader)
end
- after do
- cleanup_artifacts_from_extract_archive('light')
- end
-
it 'converts empty external classification authorization labels to nil' do
project.create_import_data(data: { override_params: { external_authorization_classification_label: "" } })
@@ -1004,10 +964,6 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
subject
end
- after do
- cleanup_artifacts_from_extract_archive('with_invalid_records')
- end
-
context 'when failures occur because a relation fails to be processed' do
it_behaves_like 'restores project successfully',
issues: 0,
diff --git a/spec/lib/gitlab/import_export/relation_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/relation_tree_restorer_spec.rb
index e9ef990d7b2..ed6d135e11b 100644
--- a/spec/lib/gitlab/import_export/relation_tree_restorer_spec.rb
+++ b/spec/lib/gitlab/import_export/relation_tree_restorer_spec.rb
@@ -126,14 +126,6 @@ describe Gitlab::ImportExport::RelationTreeRestorer do
let(:path) { 'spec/fixtures/lib/gitlab/import_export/complex/tree' }
let(:relation_reader) { Gitlab::ImportExport::JSON::NdjsonReader.new(path) }
- before :all do
- extract_archive('spec/fixtures/lib/gitlab/import_export/complex', 'tree.tar.gz')
- end
-
- after :all do
- cleanup_artifacts_from_extract_archive('complex')
- end
-
it_behaves_like 'import project successfully'
end
end
diff --git a/spec/lib/gitlab/kubernetes/kube_client_spec.rb b/spec/lib/gitlab/kubernetes/kube_client_spec.rb
index 1959fbca33b..56838f2cb7a 100644
--- a/spec/lib/gitlab/kubernetes/kube_client_spec.rb
+++ b/spec/lib/gitlab/kubernetes/kube_client_spec.rb
@@ -174,6 +174,20 @@ describe Gitlab::Kubernetes::KubeClient do
end
end
+ describe '#networking_client' do
+ subject { client.networking_client }
+
+ it_behaves_like 'a Kubeclient'
+
+ it 'has the networking API group endpoint' do
+ expect(subject.api_endpoint.to_s).to match(%r{\/apis\/networking.k8s.io\Z})
+ end
+
+ it 'has the api_version' do
+ expect(subject.instance_variable_get(:@api_version)).to eq('v1')
+ end
+ end
+
describe 'core API' do
let(:core_client) { client.core_client }
@@ -290,6 +304,30 @@ describe Gitlab::Kubernetes::KubeClient do
end
end
+ describe 'networking API group' do
+ let(:networking_client) { client.networking_client }
+
+ [
+ :create_network_policy,
+ :get_network_policies,
+ :update_network_policy,
+ :delete_network_policy
+ ].each do |method|
+ describe "##{method}" do
+ include_examples 'redirection not allowed', method
+ include_examples 'dns rebinding not allowed', method
+
+ it 'delegates to the networking client' do
+ expect(client).to delegate_method(method).to(:networking_client)
+ end
+
+ it 'responds to the method' do
+ expect(client).to respond_to method
+ end
+ end
+ end
+ end
+
describe 'non-entity methods' do
it 'does not proxy for non-entity methods' do
expect(client).not_to respond_to :proxy_url