diff options
Diffstat (limited to 'spec/frontend/fixtures/runner.rb')
-rw-r--r-- | spec/frontend/fixtures/runner.rb | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/spec/frontend/fixtures/runner.rb b/spec/frontend/fixtures/runner.rb index f60e4991292..099df607487 100644 --- a/spec/frontend/fixtures/runner.rb +++ b/spec/frontend/fixtures/runner.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Runner (JavaScript fixtures)' do +RSpec.describe 'Runner (JavaScript fixtures)', feature_category: :runner_fleet do include AdminModeHelper include ApiHelpers include JavaScriptFixturesHelpers @@ -13,7 +13,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do let_it_be(:project) { create(:project, :repository, :public) } let_it_be(:project_2) { create(:project, :repository, :public) } - let_it_be(:runner) { create(:ci_runner, :instance, description: 'My Runner', version: '1.0.0') } + let_it_be(:runner) { create(:ci_runner, :instance, description: 'My Runner', creator: admin, version: '1.0.0') } let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group], version: '2.0.0') } let_it_be(:group_runner_2) { create(:ci_runner, :group, groups: [group], version: '2.0.0') } let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project, project_2], version: '2.0.0') } @@ -58,6 +58,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do expect_graphql_errors_to_be_empty end + + it "#{fixtures_path}#{all_runners_query}.with_creator.json" do + # "last: 1" fetches the first runner created, with admin as "creator" + post_graphql(query, current_user: admin, variables: { last: 1 }) + + expect_graphql_errors_to_be_empty + end end describe 'all_runners_count.query.graphql', type: :request do @@ -145,6 +152,43 @@ RSpec.describe 'Runner (JavaScript fixtures)' do expect_graphql_errors_to_be_empty end end + + describe 'runner_for_registration.query.graphql', :freeze_time, type: :request do + runner_for_registration_query = 'register/runner_for_registration.query.graphql' + + let_it_be(:query) do + get_graphql_query_as_string("#{query_path}#{runner_for_registration_query}") + end + + it "#{fixtures_path}#{runner_for_registration_query}.json" do + post_graphql(query, current_user: admin, variables: { + id: runner.to_global_id.to_s + }) + + expect_graphql_errors_to_be_empty + end + end + + describe 'runner_create.mutation.graphql', type: :request do + runner_create_mutation = 'new/runner_create.mutation.graphql' + + let_it_be(:query) do + get_graphql_query_as_string("#{query_path}#{runner_create_mutation}") + end + + context 'with runnerType set to INSTANCE_TYPE' do + it "#{fixtures_path}#{runner_create_mutation}.json" do + post_graphql(query, current_user: admin, variables: { + input: { + runnerType: 'INSTANCE_TYPE', + description: 'My dummy runner' + } + }) + + expect_graphql_errors_to_be_empty + end + end + end end describe 'as group owner', GraphQL::Query do |