debian-mirror-gitlab/spec/requests/api/graphql/packages/helm_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
2.3 KiB
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'helm package details', feature_category: :package_registry do
2021-12-11 22:18:48 +05:30
include GraphqlHelpers
include_context 'package details setup'
2022-10-11 01:57:18 +05:30
let_it_be(:package) { create(:helm_package, :last_downloaded_at, project: project) }
2021-12-11 22:18:48 +05:30
2022-08-27 11:52:29 +05:30
let(:package_files_metadata) { query_graphql_fragment('HelmFileMetadata') }
2021-12-11 22:18:48 +05:30
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