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

helm_spec.rb « packages « graphql « api « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 65b3f80d6df74b206618da3dd63c87fed08c4b7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# frozen_string_literal: true
require 'spec_helper'

RSpec.describe 'helm package details', feature_category: :package_registry do
  include GraphqlHelpers
  include_context 'package details setup'

  let_it_be(:package) { create(:helm_package, :last_downloaded_at, project: project) }

  let(:package_files_metadata) { query_graphql_fragment('HelmFileMetadata') }

  let(:query) do
    graphql_query_for(:package, { id: package_global_id }, <<~FIELDS)
    #{all_graphql_fields_for('PackageDetailsType', max_depth: depth, excluded: excluded)}
    packageFiles {
      nodes {
        #{package_files}
        fileMetadata {
          #{package_files_metadata}
        }
      }
    }
    FIELDS
  end

  subject { post_graphql(query, current_user: user) }

  before do
    subject
  end

  it_behaves_like 'a package detail'
  it_behaves_like 'a package with files'

  it 'has the correct file metadata' do
    expect(first_file_response_metadata).to include(
      'channel' => first_file.helm_file_metadatum.channel
    )
    expect(first_file_response_metadata['metadata']).to include(
      'name' => first_file.helm_file_metadatum.metadata['name'],
      'home' => first_file.helm_file_metadatum.metadata['home'],
      'sources' => first_file.helm_file_metadatum.metadata['sources'],
      'version' => first_file.helm_file_metadatum.metadata['version'],
      'description' => first_file.helm_file_metadatum.metadata['description'],
      'keywords' => first_file.helm_file_metadatum.metadata['keywords'],
      'maintainers' => first_file.helm_file_metadatum.metadata['maintainers'],
      'icon' => first_file.helm_file_metadatum.metadata['icon'],
      'apiVersion' => first_file.helm_file_metadatum.metadata['apiVersion'],
      'condition' => first_file.helm_file_metadatum.metadata['condition'],
      'tags' => first_file.helm_file_metadatum.metadata['tags'],
      'appVersion' => first_file.helm_file_metadatum.metadata['appVersion'],
      'deprecated' => first_file.helm_file_metadatum.metadata['deprecated'],
      'annotations' => first_file.helm_file_metadatum.metadata['annotations'],
      'kubeVersion' => first_file.helm_file_metadatum.metadata['kubeVersion'],
      'dependencies' => first_file.helm_file_metadatum.metadata['dependencies'],
      'type' => first_file.helm_file_metadatum.metadata['type']
    )
  end
end