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:
Diffstat (limited to 'spec/lib/gitlab/kas')
-rw-r--r--spec/lib/gitlab/kas/client_spec.rb26
-rw-r--r--spec/lib/gitlab/kas/user_access_spec.rb36
2 files changed, 16 insertions, 46 deletions
diff --git a/spec/lib/gitlab/kas/client_spec.rb b/spec/lib/gitlab/kas/client_spec.rb
index 5668c265611..e8884ce352f 100644
--- a/spec/lib/gitlab/kas/client_spec.rb
+++ b/spec/lib/gitlab/kas/client_spec.rb
@@ -77,8 +77,9 @@ RSpec.describe Gitlab::Kas::Client do
let(:request) { instance_double(Gitlab::Agent::ConfigurationProject::Rpc::ListAgentConfigFilesRequest) }
let(:response) { double(Gitlab::Agent::ConfigurationProject::Rpc::ListAgentConfigFilesResponse, config_files: agent_configurations) }
- let(:repository) { instance_double(Gitlab::Agent::Modserver::Repository) }
- let(:gitaly_address) { instance_double(Gitlab::Agent::Modserver::GitalyAddress) }
+ let(:repository) { instance_double(Gitlab::Agent::Entity::GitalyRepository) }
+ let(:gitaly_info) { instance_double(Gitlab::Agent::Entity::GitalyInfo) }
+ let(:gitaly_features) { Feature::Gitaly.server_feature_flags }
let(:agent_configurations) { [double] }
@@ -89,16 +90,16 @@ RSpec.describe Gitlab::Kas::Client do
.with('example.kas.internal', :this_channel_is_insecure, timeout: described_class::TIMEOUT)
.and_return(stub)
- expect(Gitlab::Agent::Modserver::Repository).to receive(:new)
+ expect(Gitlab::Agent::Entity::GitalyRepository).to receive(:new)
.with(project.repository.gitaly_repository.to_h)
.and_return(repository)
- expect(Gitlab::Agent::Modserver::GitalyAddress).to receive(:new)
- .with(Gitlab::GitalyClient.connection_data(project.repository_storage))
- .and_return(gitaly_address)
+ expect(Gitlab::Agent::Entity::GitalyInfo).to receive(:new)
+ .with(Gitlab::GitalyClient.connection_data(project.repository_storage).merge(features: gitaly_features))
+ .and_return(gitaly_info)
expect(Gitlab::Agent::ConfigurationProject::Rpc::ListAgentConfigFilesRequest).to receive(:new)
- .with(repository: repository, gitaly_address: gitaly_address)
+ .with(repository: repository, gitaly_info: gitaly_info)
.and_return(request)
expect(stub).to receive(:list_agent_config_files)
@@ -112,7 +113,8 @@ RSpec.describe Gitlab::Kas::Client do
describe '#send_git_push_event' do
let(:stub) { instance_double(Gitlab::Agent::Notifications::Rpc::Notifications::Stub) }
let(:request) { instance_double(Gitlab::Agent::Notifications::Rpc::GitPushEventRequest) }
- let(:project_param) { instance_double(Gitlab::Agent::Notifications::Rpc::Project) }
+ let(:event_param) { instance_double(Gitlab::Agent::Event::GitPushEvent) }
+ let(:project_param) { instance_double(Gitlab::Agent::Event::Project) }
let(:response) { double(Gitlab::Agent::Notifications::Rpc::GitPushEventResponse) }
subject { described_class.new.send_git_push_event(project: project) }
@@ -122,12 +124,16 @@ RSpec.describe Gitlab::Kas::Client do
.with('example.kas.internal', :this_channel_is_insecure, timeout: described_class::TIMEOUT)
.and_return(stub)
- expect(Gitlab::Agent::Notifications::Rpc::Project).to receive(:new)
+ expect(Gitlab::Agent::Event::Project).to receive(:new)
.with(id: project.id, full_path: project.full_path)
.and_return(project_param)
- expect(Gitlab::Agent::Notifications::Rpc::GitPushEventRequest).to receive(:new)
+ expect(Gitlab::Agent::Event::GitPushEvent).to receive(:new)
.with(project: project_param)
+ .and_return(event_param)
+
+ expect(Gitlab::Agent::Notifications::Rpc::GitPushEventRequest).to receive(:new)
+ .with(event: event_param)
.and_return(request)
expect(stub).to receive(:git_push_event)
diff --git a/spec/lib/gitlab/kas/user_access_spec.rb b/spec/lib/gitlab/kas/user_access_spec.rb
index a8296d23a18..8a52d76215b 100644
--- a/spec/lib/gitlab/kas/user_access_spec.rb
+++ b/spec/lib/gitlab/kas/user_access_spec.rb
@@ -11,42 +11,6 @@ RSpec.describe Gitlab::Kas::UserAccess, feature_category: :deployment_management
end
it { is_expected.to be true }
-
- context 'when flag kas_user_access is disabled' do
- before do
- stub_feature_flags(kas_user_access: false)
- end
-
- it { is_expected.to be false }
- end
- end
-
- describe '.enabled_for?' do
- subject { described_class.enabled_for?(agent) }
-
- let(:agent) { build(:cluster_agent) }
-
- before do
- allow(::Gitlab::Kas).to receive(:enabled?).and_return true
- end
-
- it { is_expected.to be true }
-
- context 'when flag kas_user_access is disabled' do
- before do
- stub_feature_flags(kas_user_access: false)
- end
-
- it { is_expected.to be false }
- end
-
- context 'when flag kas_user_access_project is disabled' do
- before do
- stub_feature_flags(kas_user_access_project: false)
- end
-
- it { is_expected.to be false }
- end
end
describe '.{encrypt,decrypt}_public_session_id' do