Skip to content

Commit ca72c63

Browse files
committed
add spec
1 parent 48d9616 commit ca72c63

File tree

122 files changed

+11335
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+11335
-0
lines changed

docs/_layouts/about.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
layout: default
3+
---
4+
5+
{{ content }}

docs/_layouts/default.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
layout: table_wrappers
3+
---
4+
5+
<!DOCTYPE html>
6+
7+
<html lang="{{ site.lang | default: 'en-US' }}">
8+
{% assign version = page.version | default: 'latest' %}
9+
{% include nav.html pages=site.pages version=version %}
10+
{% include head.html %}
11+
12+
<script src="https://polyfill.io/v3/polyfill.js?features=es6">
13+
</script>
14+
15+
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
16+
17+
<body>
18+
<a class="skip-to-main" href="#main-content">Skip to main content</a>
19+
{% include icons/icons.html %}
20+
{% include components/sidebar.html %}
21+
<div class="main" id="top">
22+
{% include components/header.html %}
23+
<div class="main-content-wrap">
24+
{% include components/breadcrumbs.html %}
25+
<div id="main-content" class="main-content">
26+
<main>
27+
{% if site.heading_anchors != false %}
28+
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16
29+
16\" aria-hidden=\"true\">
30+
<use xlink:href=\"#svg-link\"></use>
31+
</svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
32+
{% else %}
33+
{{ content }}
34+
{% endif %}
35+
36+
{% if page.has_children == true and page.has_toc != false %}
37+
{% include components/children_nav.html %}
38+
{% endif %}
39+
</main>
40+
{% include components/footer.html %}
41+
</div>
42+
</div>
43+
{% if site.search_enabled != false %}
44+
{% include components/search_footer.html %}
45+
{% endif %}
46+
</div>
47+
48+
{% if site.mermaid %}
49+
{% include components/mermaid.html %}
50+
{% endif %}
51+
</body>
52+
53+
</html>

docs/_layouts/home.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
layout: default
3+
---
4+
5+
{{ content }}

docs/_layouts/minimal.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
layout: table_wrappers
3+
---
4+
5+
<!DOCTYPE html>
6+
7+
<html lang="{{ site.lang | default: 'en-US' }}">
8+
{% include head.html %}
9+
<body>
10+
<a class="skip-to-main" href="#main-content">Skip to main content</a>
11+
{% include icons/icons.html %}
12+
<div class="main-content-wrap" id="top">
13+
{% include components/breadcrumbs.html %}
14+
<div id="main-content" class="main-content" role="main">
15+
{% if site.heading_anchors != false %}
16+
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
17+
{% else %}
18+
{{ content }}
19+
{% endif %}
20+
21+
{% if page.has_children == true and page.has_toc != false %}
22+
{% include components/children_nav.html %}
23+
{% endif %}
24+
25+
{% include components/footer.html %}
26+
27+
</div>
28+
</div>
29+
30+
{% if site.mermaid %}
31+
{% include components/mermaid.html %}
32+
{% endif %}
33+
</body>
34+
</html>

docs/_layouts/page.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
layout: default
3+
---
4+
5+
{{ content }}

docs/_layouts/post.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
layout: default
3+
---
4+
5+
{{ content }}

docs/_layouts/table_wrappers.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
layout: vendor/compress
3+
---
4+
5+
{% assign content_ = content | replace: '<table', '<div class="table-wrapper"><table' %}
6+
{% assign content_ = content_ | replace: '</table>', '</table></div>' %}
7+
{{ content_ }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../spec_helper'
4+
5+
describe 'additional storage configured', acceptance: true do
6+
include_context 'libvirt_acceptance'
7+
8+
before do
9+
environment.skeleton('additional_storage')
10+
end
11+
12+
after do
13+
assert_execute('vagrant', 'destroy', '--force')
14+
end
15+
16+
it 'should succeed' do
17+
status('Test: machine is created successfully')
18+
result = environment.execute('vagrant', 'up')
19+
expect(result).to exit_with(0)
20+
21+
status('Test: additional storage configured')
22+
expect(result.stdout).to match(/\(vda\).*work_default.img/)
23+
expect(result.stdout).to match(/\(vdb\).*work_default-vdb\.qcow2/)
24+
25+
status('Test: reload handles additional storage correctly')
26+
result = environment.execute('vagrant', 'reload')
27+
expect(result).to exit_with(0)
28+
end
29+
end

spec/acceptance/networking_spec.rb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../spec_helper'
4+
5+
describe 'package domain', acceptance: true do
6+
include_context 'libvirt_acceptance'
7+
8+
before(:all) do
9+
expect(Vagrant::Util::Which.which('virsh')).to be_truthy,
10+
'networking tests require virsh, please install'
11+
expect(system('virsh --connect=qemu:///system uri >/dev/null')).to be_truthy,
12+
'network tests require access to qemu:///system context, please ensure test user has correct permissions'
13+
end
14+
15+
after(:each) do
16+
assert_execute('vagrant', 'destroy', '--force')
17+
end
18+
19+
before do
20+
environment.skeleton('network_no_autostart')
21+
end
22+
23+
context 'when host is rebooted' do
24+
before do
25+
result = environment.execute('vagrant', 'up')
26+
expect(result).to exit_with(0)
27+
28+
result = environment.execute('vagrant', 'halt')
29+
expect(result).to exit_with(0)
30+
31+
result = environment.execute('virsh', '--connect=qemu:///system', 'net-destroy', 'vagrant-libvirt-test')
32+
expect(result).to exit_with(0)
33+
end
34+
35+
it 'should start networking on restart' do
36+
status('Test: machine restarts networking')
37+
result = environment.execute('vagrant', 'up')
38+
expect(result).to exit_with(0)
39+
end
40+
end
41+
end
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../spec_helper'
4+
5+
describe 'package domain', acceptance: true do
6+
include_context 'libvirt_acceptance'
7+
8+
before(:all) do
9+
expect(Vagrant::Util::Which.which('virt-sysprep')).to be_truthy,
10+
'packaging tests require virt-sysprep, please install'
11+
expect(Vagrant::Util::Which.which('virt-sparsify')).to be_truthy,
12+
'packaging tests require virt-sparsify, please install'
13+
14+
result = (File.exist?('C:\\') ? `dir /-C #{Dir.tmpdir}` : `df #{Dir.tmpdir}`).split("\n").last
15+
expect(result.split[3].to_i).to be > 6 * 1024 * 1024,
16+
"packaging tests require more than 6GiB of space under #{Dir.tmpdir}"
17+
end
18+
19+
after(:each) do
20+
assert_execute('vagrant', 'destroy', '--force')
21+
end
22+
23+
let(:testbox_envvars) { { VAGRANT_VAGRANTFILE: 'Vagrantfile.testbox' } }
24+
25+
context 'simple' do
26+
before do
27+
environment.skeleton('package_simple')
28+
end
29+
30+
after do
31+
result = environment.execute('vagrant', 'destroy', '--force', extra_env: testbox_envvars)
32+
expect(result).to exit_with(0)
33+
34+
assert_execute('vagrant', 'box', 'remove', '--force', 'test-package-simple-domain')
35+
end
36+
37+
it 'should succeed' do
38+
status('Test: machine is created successfully')
39+
expect(environment.execute('vagrant', 'up')).to exit_with(0)
40+
41+
status('Test: package machine successfully')
42+
expect(environment.execute('vagrant', 'package')).to exit_with(0)
43+
44+
status('Test: add packaged box')
45+
expect(environment.execute(
46+
'vagrant', 'box', 'add', '--force', '--name', 'test-package-simple-domain', 'package.box'
47+
)).to exit_with(0)
48+
49+
status('Test: machine from packaged box is created successfully')
50+
result = environment.execute('vagrant', 'up', extra_env: testbox_envvars)
51+
expect(result).to exit_with(0)
52+
expect(result.stdout).to match(/test-package-simple-domain/)
53+
end
54+
end
55+
56+
context 'complex' do
57+
before do
58+
environment.skeleton('package_complex')
59+
extra_env.merge!(
60+
{
61+
VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS: 'defaults,-ssh-userdir,customize',
62+
VAGRANT_LIBVIRT_VIRT_SYSPREP_OPTIONS: '--run $(pwd)/scripts/sysprep.sh',
63+
}
64+
)
65+
end
66+
67+
after do
68+
expect(environment.execute('vagrant', 'destroy', '--force', extra_env: testbox_envvars)).to exit_with(0)
69+
assert_execute('vagrant', 'box', 'remove', '--force', 'test-package-complex-domain')
70+
end
71+
72+
it 'should succeed' do
73+
status('Test: machine is created successfully')
74+
expect(environment.execute('vagrant', 'up')).to exit_with(0)
75+
76+
status('Test: package machine successfully')
77+
expect(environment.execute('vagrant', 'package')).to exit_with(0)
78+
79+
status('Test: add packaged box')
80+
expect(environment.execute(
81+
'vagrant', 'box', 'add', '--force', '--name', 'test-package-complex-domain', 'package.box'
82+
)).to exit_with(0)
83+
84+
status('Test: machine from packaged box is created successfully')
85+
result = environment.execute('vagrant', 'up', extra_env: testbox_envvars)
86+
expect(result).to exit_with(0)
87+
expect(result.stdout).to match(/test-package-complex-domain/)
88+
end
89+
end
90+
end

0 commit comments

Comments
 (0)