foreman_omaha 3.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/Rakefile +4 -2
- data/app/controllers/api/v2/omaha_groups_controller.rb +2 -0
- data/app/controllers/api/v2/omaha_reports_controller.rb +2 -0
- data/app/controllers/omaha_groups_controller.rb +2 -0
- data/app/controllers/omaha_hosts_controller.rb +6 -4
- data/app/controllers/omaha_reports_controller.rb +2 -0
- data/app/graphql/concerns/foreman_omaha/types/host_extensions.rb +13 -0
- data/app/graphql/foreman_omaha/types/omaha_group.rb +21 -0
- data/app/graphql/foreman_omaha/types/omaha_report.rb +21 -0
- data/app/graphql/foreman_omaha/types/omaha_report_status_enum.rb +11 -0
- data/app/helpers/concerns/foreman_omaha/hosts_helper_extensions.rb +2 -0
- data/app/helpers/foreman_omaha/application_helper.rb +2 -0
- data/app/helpers/foreman_omaha/omaha_groups_helper.rb +2 -0
- data/app/helpers/omaha_hosts_helper.rb +2 -0
- data/app/helpers/omaha_reports_helper.rb +2 -0
- data/app/models/concerns/foreman_omaha/host_extensions.rb +3 -1
- data/app/models/concerns/foreman_omaha/omaha_facet_host_extensions.rb +2 -0
- data/app/models/foreman_omaha/fact_name.rb +2 -0
- data/app/models/foreman_omaha/omaha_facet.rb +2 -0
- data/app/models/foreman_omaha/omaha_group.rb +4 -0
- data/app/models/foreman_omaha/omaha_report.rb +4 -0
- data/app/models/host_status/omaha_status.rb +2 -0
- data/app/services/foreman_omaha/charts/oem_distribution.rb +2 -0
- data/app/services/foreman_omaha/charts/status_distribution.rb +2 -0
- data/app/services/foreman_omaha/charts/version_distribution.rb +2 -0
- data/app/services/foreman_omaha/container_linux_config_transpiler.rb +3 -0
- data/app/services/foreman_omaha/fact_importer.rb +2 -0
- data/app/services/foreman_omaha/fact_parser.rb +11 -3
- data/app/services/foreman_omaha/group_version_breakdown.rb +2 -0
- data/app/services/foreman_omaha/omaha_report_importer.rb +2 -0
- data/app/services/foreman_omaha/status_mapper.rb +2 -2
- data/app/services/foreman_omaha/template_renderer_helper.rb +9 -0
- data/app/views/api/v2/omaha_groups/base.json.rabl +2 -0
- data/app/views/api/v2/omaha_groups/index.json.rabl +2 -0
- data/app/views/api/v2/omaha_groups/main.json.rabl +2 -0
- data/app/views/api/v2/omaha_groups/show.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/base.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/create.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/index.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/main.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/show.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/update.json.rabl +2 -0
- data/app/views/foreman_omaha/api/v2/omaha_facets/base.json.rabl +2 -0
- data/app/views/foreman_omaha/api/v2/omaha_facets/base_with_root.json.rabl +2 -0
- data/app/views/foreman_omaha/api/v2/omaha_facets/show.json.rabl +2 -0
- data/app/views/omaha_reports/_list.html.erb +1 -1
- data/config/routes.rb +2 -0
- data/db/migrate/20160812083100_add_omaha_fields_to_reports.foreman_omaha.rb +2 -0
- data/db/migrate/20171101204100_create_omaha_facets.foreman_omaha.rb +2 -0
- data/db/seeds.d/200_omaha_groups.rb +2 -0
- data/db/seeds.d/60_omaha_proxy_feature.rb +2 -0
- data/lib/foreman_omaha/engine.rb +28 -14
- data/lib/foreman_omaha/version.rb +3 -1
- data/lib/foreman_omaha.rb +2 -0
- data/lib/tasks/foreman_omaha_tasks.rake +2 -0
- data/locale/gemspec.rb +2 -0
- data/test/factories/feature.rb +3 -1
- data/test/factories/foreman_omaha_factories.rb +8 -6
- data/test/factories/host.rb +19 -4
- data/test/factories/smart_proxy.rb +2 -0
- data/test/functional/api/v2/omaha_groups_controller_test.rb +2 -0
- data/test/functional/api/v2/omaha_reports_controller_test.rb +4 -2
- data/test/functional/omaha_groups_controller_test.rb +2 -0
- data/test/functional/omaha_hosts_controller_test.rb +2 -0
- data/test/functional/omaha_reports_controller_test.rb +2 -0
- data/test/graphql/queries/host_query_extensions_test.rb +41 -0
- data/test/graphql/queries/omaha_group_query_test.rb +51 -0
- data/test/graphql/queries/omaha_groups_query_test.rb +47 -0
- data/test/graphql/queries/omaha_report_query_test.rb +44 -0
- data/test/graphql/queries/omaha_reports_query_test.rb +47 -0
- data/test/test_plugin_helper.rb +2 -0
- data/test/unit/charts/oem_distribution_test.rb +2 -0
- data/test/unit/charts/status_distribution_test.rb +2 -0
- data/test/unit/charts/version_distribution_test.rb +2 -0
- data/test/unit/group_version_breakdown_test.rb +2 -0
- data/test/unit/host_status/omaha_status_test.rb +4 -2
- data/test/unit/host_test.rb +2 -0
- data/test/unit/omaha_fact_parser_test.rb +67 -23
- data/test/unit/omaha_report_test.rb +2 -0
- data/test/unit/renderer_test.rb +2 -0
- metadata +64 -9
- data/app/lib/foreman_omaha/renderer/scope/macros/omaha.rb +0 -13
data/locale/gemspec.rb
CHANGED
data/test/factories/feature.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
FactoryBot.define do
|
2
4
|
factory :omaha_report, :class => 'ForemanOmaha::OmahaReport' do
|
3
5
|
host
|
4
6
|
sequence(:reported_at) { |n| n.minutes.ago }
|
5
|
-
status 1
|
6
|
-
omaha_version '1068.9.0'
|
7
|
-
type 'ForemanOmaha::OmahaReport'
|
7
|
+
status { 1 }
|
8
|
+
omaha_version { '1068.9.0' }
|
9
|
+
type { 'ForemanOmaha::OmahaReport' }
|
8
10
|
end
|
9
11
|
|
10
12
|
factory :omaha_facet, :class => 'ForemanOmaha::OmahaFacet' do
|
11
13
|
sequence(:last_report) { |n| n.minutes.ago }
|
12
|
-
version '1068.9.0'
|
13
|
-
oem 'rackspace'
|
14
|
+
version { '1068.9.0' }
|
15
|
+
oem { 'rackspace' }
|
14
16
|
sequence(:machineid) { SecureRandom.hex }
|
15
|
-
status 1
|
17
|
+
status { 1 }
|
16
18
|
host
|
17
19
|
omaha_group
|
18
20
|
end
|
data/test/factories/host.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
FactoryBot.modify do
|
2
4
|
factory :host do
|
3
5
|
trait :with_omaha_facet do
|
4
6
|
association :omaha_facet, :factory => :omaha_facet, :strategy => :build
|
5
7
|
|
6
8
|
transient do
|
7
|
-
omaha_status 1
|
8
|
-
omaha_version '1068.9.0'
|
9
|
-
omaha_oem 'rackspace'
|
10
|
-
omaha_group nil
|
9
|
+
omaha_status { 1 }
|
10
|
+
omaha_version { '1068.9.0' }
|
11
|
+
omaha_oem { 'rackspace' }
|
12
|
+
omaha_group { nil }
|
11
13
|
end
|
12
14
|
|
13
15
|
after(:build) do |host, evaluator|
|
@@ -17,5 +19,18 @@ FactoryBot.modify do
|
|
17
19
|
host.omaha_facet.omaha_group = evaluator.omaha_group if evaluator.omaha_group.present?
|
18
20
|
end
|
19
21
|
end
|
22
|
+
|
23
|
+
trait :with_omaha_reports do
|
24
|
+
with_omaha_facet
|
25
|
+
transient do
|
26
|
+
omaha_report_count { 5 }
|
27
|
+
end
|
28
|
+
after(:create) do |host, evaluator|
|
29
|
+
evaluator.omaha_report_count.times do |i|
|
30
|
+
FactoryBot.create(:omaha_report, host: host, reported_at: (evaluator.omaha_report_count - i).minutes.ago)
|
31
|
+
end
|
32
|
+
host.omaha_facet.update_attribute(:last_report, host.omaha_reports.last.reported_at) # rubocop:disable Rails/SkipsModelValidations
|
33
|
+
end
|
34
|
+
end
|
20
35
|
end
|
21
36
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
class Api::V2::OmahaReportsControllerTest < ActionController::TestCase
|
@@ -53,7 +55,7 @@ class Api::V2::OmahaReportsControllerTest < ActionController::TestCase
|
|
53
55
|
assert_response :success
|
54
56
|
assert_not_nil assigns(:omaha_reports)
|
55
57
|
reports = ActiveSupport::JSON.decode(@response.body)
|
56
|
-
|
58
|
+
assert_empty reports['results']
|
57
59
|
assert_equal 0, reports['results'].count
|
58
60
|
end
|
59
61
|
|
@@ -98,7 +100,7 @@ class Api::V2::OmahaReportsControllerTest < ActionController::TestCase
|
|
98
100
|
|
99
101
|
test 'hosts with a registered smart proxy on should create a report successfully' do
|
100
102
|
Setting[:restrict_registered_smart_proxies] = true
|
101
|
-
Setting[:require_ssl_smart_proxies] = false
|
103
|
+
Setting[:require_ssl_smart_proxies] = false if Gem::Version.new(SETTINGS[:version].notag) < Gem::Version.new('3.1')
|
102
104
|
|
103
105
|
proxy = FactoryBot.create(:smart_proxy, :omaha)
|
104
106
|
host = URI.parse(proxy.url).host
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module Queries
|
6
|
+
class HostQueryExtensionsTest < GraphQLQueryTestCase
|
7
|
+
let(:query) do
|
8
|
+
<<-GRAPHQL
|
9
|
+
query (
|
10
|
+
$id: String!
|
11
|
+
) {
|
12
|
+
host(id: $id) {
|
13
|
+
id
|
14
|
+
omahaReports {
|
15
|
+
totalCount
|
16
|
+
edges {
|
17
|
+
node {
|
18
|
+
id
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
GRAPHQL
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:host) do
|
28
|
+
FactoryBot.create(:host, :managed, :with_omaha_reports)
|
29
|
+
end
|
30
|
+
let(:global_id) { Foreman::GlobalId.encode('Host', host.id) }
|
31
|
+
let(:variables) { { id: Foreman::GlobalId.encode('Host', host.id) } }
|
32
|
+
let(:data) { result['data']['host'] }
|
33
|
+
|
34
|
+
test 'fetching host attributes with omaha extensions' do
|
35
|
+
assert_empty result['errors']
|
36
|
+
assert_equal global_id, data['id']
|
37
|
+
|
38
|
+
assert_collection host.omaha_reports, data['omahaReports']
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module Queries
|
6
|
+
class OmahaGroupQueryTest < GraphQLQueryTestCase
|
7
|
+
let(:query) do
|
8
|
+
<<-GRAPHQL
|
9
|
+
query omahaGroupQuery (
|
10
|
+
$id: String!
|
11
|
+
) {
|
12
|
+
omahaGroup(id: $id) {
|
13
|
+
id
|
14
|
+
name
|
15
|
+
uuid
|
16
|
+
createdAt
|
17
|
+
updatedAt
|
18
|
+
hosts {
|
19
|
+
totalCount
|
20
|
+
edges {
|
21
|
+
node {
|
22
|
+
id
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
GRAPHQL
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:omaha_group) { FactoryBot.create(:omaha_group) }
|
32
|
+
let(:global_id) { Foreman::GlobalId.for(omaha_group) }
|
33
|
+
let(:variables) { { id: global_id } }
|
34
|
+
let(:data) { result['data']['omahaGroup'] }
|
35
|
+
|
36
|
+
test 'fetching omaha group attributes' do
|
37
|
+
FactoryBot.create(:host, :managed, :with_omaha_facet, omaha_group: omaha_group)
|
38
|
+
|
39
|
+
assert_empty result['errors']
|
40
|
+
assert_not_nil data
|
41
|
+
|
42
|
+
assert_equal global_id, data['id']
|
43
|
+
assert_equal omaha_group.created_at.utc.iso8601, data['createdAt']
|
44
|
+
assert_equal omaha_group.updated_at.utc.iso8601, data['updatedAt']
|
45
|
+
assert_equal omaha_group.name, data['name']
|
46
|
+
assert_equal omaha_group.uuid, data['uuid']
|
47
|
+
|
48
|
+
assert_collection omaha_group.hosts, data['hosts'], type_name: 'Host'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module Queries
|
6
|
+
class OmahaGroupsQueryTest < GraphQLQueryTestCase
|
7
|
+
let(:query) do
|
8
|
+
<<-GRAPHQL
|
9
|
+
query omahaGroupsQuery {
|
10
|
+
omahaGroups {
|
11
|
+
totalCount
|
12
|
+
pageInfo {
|
13
|
+
startCursor
|
14
|
+
endCursor
|
15
|
+
hasNextPage
|
16
|
+
hasPreviousPage
|
17
|
+
}
|
18
|
+
edges {
|
19
|
+
cursor
|
20
|
+
node {
|
21
|
+
id
|
22
|
+
name
|
23
|
+
uuid
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
GRAPHQL
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:data) { result['data']['omahaGroups'] }
|
32
|
+
|
33
|
+
setup do
|
34
|
+
FactoryBot.create_list(:omaha_group, 2)
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'fetching models attributes' do
|
38
|
+
assert_empty result['errors']
|
39
|
+
|
40
|
+
expected_count = ForemanOmaha::OmahaGroup.count
|
41
|
+
|
42
|
+
assert_not_equal 0, expected_count
|
43
|
+
assert_equal expected_count, data['totalCount']
|
44
|
+
assert_equal expected_count, data['edges'].count
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module Queries
|
6
|
+
class OmahaReportQueryTest < GraphQLQueryTestCase
|
7
|
+
let(:query) do
|
8
|
+
<<-GRAPHQL
|
9
|
+
query omahaReportQuery (
|
10
|
+
$id: String!
|
11
|
+
) {
|
12
|
+
omahaReport(id: $id) {
|
13
|
+
id
|
14
|
+
status
|
15
|
+
omahaVersion
|
16
|
+
createdAt
|
17
|
+
updatedAt
|
18
|
+
host {
|
19
|
+
id
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
GRAPHQL
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:omaha_report) { FactoryBot.create(:omaha_report) }
|
27
|
+
let(:global_id) { Foreman::GlobalId.for(omaha_report) }
|
28
|
+
let(:variables) { { id: global_id } }
|
29
|
+
let(:data) { result['data']['omahaReport'] }
|
30
|
+
|
31
|
+
test 'fetching omaha report attributes' do
|
32
|
+
assert_empty result['errors']
|
33
|
+
assert_not_nil data
|
34
|
+
|
35
|
+
assert_equal global_id, data['id']
|
36
|
+
assert_equal omaha_report.created_at.utc.iso8601, data['createdAt']
|
37
|
+
assert_equal omaha_report.updated_at.utc.iso8601, data['updatedAt']
|
38
|
+
assert_equal omaha_report.status, data['status']
|
39
|
+
assert_equal omaha_report.omaha_version, data['omahaVersion']
|
40
|
+
|
41
|
+
assert_record omaha_report.host, data['host']
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module Queries
|
6
|
+
class OmahaReportsQueryTest < GraphQLQueryTestCase
|
7
|
+
let(:query) do
|
8
|
+
<<-GRAPHQL
|
9
|
+
query omahaReportsQuery {
|
10
|
+
omahaReports {
|
11
|
+
totalCount
|
12
|
+
pageInfo {
|
13
|
+
startCursor
|
14
|
+
endCursor
|
15
|
+
hasNextPage
|
16
|
+
hasPreviousPage
|
17
|
+
}
|
18
|
+
edges {
|
19
|
+
cursor
|
20
|
+
node {
|
21
|
+
id
|
22
|
+
status
|
23
|
+
omahaVersion
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
GRAPHQL
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:data) { result['data']['omahaReports'] }
|
32
|
+
|
33
|
+
setup do
|
34
|
+
FactoryBot.create_list(:omaha_report, 2)
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'fetching omaha reports attributes' do
|
38
|
+
assert_empty result['errors']
|
39
|
+
|
40
|
+
expected_count = ForemanOmaha::OmahaReport.count
|
41
|
+
|
42
|
+
assert_not_equal 0, expected_count
|
43
|
+
assert_equal expected_count, data['totalCount']
|
44
|
+
assert_equal expected_count, data['edges'].count
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/test/test_plugin_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_plugin_helper'
|
2
4
|
|
3
5
|
class OmahaStatusTest < ActiveSupport::TestCase
|
@@ -10,10 +12,10 @@ class OmahaStatusTest < ActiveSupport::TestCase
|
|
10
12
|
end
|
11
13
|
|
12
14
|
test '#relevant? is only for hosts with an omaha facet' do
|
13
|
-
|
15
|
+
assert status.relevant?
|
14
16
|
|
15
17
|
status.host = FactoryBot.build_stubbed(:host)
|
16
18
|
|
17
|
-
|
19
|
+
assert_not status.relevant?
|
18
20
|
end
|
19
21
|
end
|
data/test/unit/host_test.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
class OmahaFactsParserTest < ActiveSupport::TestCase
|
@@ -19,7 +21,8 @@ class OmahaFactsParserTest < ActiveSupport::TestCase
|
|
19
21
|
'osminor' => '9.0',
|
20
22
|
'ipaddress' => '127.0.0.1',
|
21
23
|
'ipaddress6' => '',
|
22
|
-
'hostname' => 'client.example.com'
|
24
|
+
'hostname' => 'client.example.com',
|
25
|
+
'distribution' => 'coreos'
|
23
26
|
}
|
24
27
|
end
|
25
28
|
let(:importer) { ::ForemanOmaha::FactParser.new(facts) }
|
@@ -35,17 +38,53 @@ class OmahaFactsParserTest < ActiveSupport::TestCase
|
|
35
38
|
|
36
39
|
context '#operatingsystem' do
|
37
40
|
let(:os) { importer.operatingsystem }
|
41
|
+
let(:expected_os_default_templates) do
|
42
|
+
OsDefaultTemplate.joins(:provisioning_template)
|
43
|
+
.where(operatingsystem: os)
|
44
|
+
.where(templates: { name: Setting[:default_host_init_config_template] })
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'without distribution fact' do
|
48
|
+
setup do
|
49
|
+
facts.delete('distribution')
|
50
|
+
end
|
51
|
+
|
52
|
+
test 'should return an OS with correct params' do
|
53
|
+
assert_equal 'CoreOS', os.name
|
54
|
+
assert_equal 'CoreOS 1068.9.0', os.description
|
55
|
+
end
|
56
|
+
end
|
38
57
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
58
|
+
context 'CoreOS' do
|
59
|
+
test 'should return an OS with correct params' do
|
60
|
+
assert_kind_of Operatingsystem, os
|
61
|
+
assert_equal '1068', os.major
|
62
|
+
assert_equal '9.0', os.minor
|
63
|
+
assert_equal 'CoreOS', os.name
|
64
|
+
assert_equal 'CoreOS 1068.9.0', os.description
|
65
|
+
assert_equal 'stable', os.release_name
|
66
|
+
assert_empty os.ptables
|
67
|
+
assert_empty os.media
|
68
|
+
assert_same_elements os.os_default_templates, expected_os_default_templates
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'Flatcar' do
|
73
|
+
setup do
|
74
|
+
facts['distribution'] = 'flatcar'
|
75
|
+
end
|
76
|
+
|
77
|
+
test 'should return an OS with correct params' do
|
78
|
+
assert_kind_of Operatingsystem, os
|
79
|
+
assert_equal '1068', os.major
|
80
|
+
assert_equal '9.0', os.minor
|
81
|
+
assert_equal 'Flatcar', os.name
|
82
|
+
assert_equal 'Flatcar 1068.9.0', os.description
|
83
|
+
assert_equal 'stable', os.release_name
|
84
|
+
assert_empty os.ptables
|
85
|
+
assert_empty os.media
|
86
|
+
assert_same_elements os.os_default_templates, expected_os_default_templates
|
87
|
+
end
|
49
88
|
end
|
50
89
|
|
51
90
|
context 'with old versions' do
|
@@ -54,23 +93,28 @@ class OmahaFactsParserTest < ActiveSupport::TestCase
|
|
54
93
|
:major => '899',
|
55
94
|
:minor => '17.0',
|
56
95
|
:title => 'CoreOS 899.17.0')
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
96
|
+
|
97
|
+
previous.reload
|
98
|
+
end
|
99
|
+
|
100
|
+
let(:previous) do
|
101
|
+
FactoryBot.create(:coreos,
|
102
|
+
:with_associations,
|
103
|
+
:with_provision,
|
104
|
+
:major => '1010',
|
105
|
+
:minor => '5.0',
|
106
|
+
:title => 'CoreOS 1010.5.0')
|
63
107
|
end
|
64
108
|
|
65
109
|
test 'should copy attributes from previous os version' do
|
66
110
|
assert_equal '1068', os.major
|
67
111
|
assert_equal '9.0', os.minor
|
68
|
-
assert_equal
|
69
|
-
assert_equal
|
70
|
-
assert_equal
|
71
|
-
|
72
|
-
|
73
|
-
|
112
|
+
assert_equal previous.ptables, os.ptables
|
113
|
+
assert_equal previous.architectures, os.architectures
|
114
|
+
assert_equal previous.media, os.media
|
115
|
+
assert_same_elements previous.os_default_templates.map(&:template_kind), os.os_default_templates.map(&:template_kind)
|
116
|
+
assert_same_elements previous.os_default_templates.map(&:provisioning_template), os.os_default_templates.map(&:provisioning_template)
|
117
|
+
assert_same_elements previous.provisioning_templates, os.provisioning_templates
|
74
118
|
end
|
75
119
|
end
|
76
120
|
end
|