summaryrefslogtreecommitdiff
path: root/spec/one_node
diff options
context:
space:
mode:
authorYuya Kusakabe <yuya.kusakabe@gmail.com>2017-01-11 01:36:05 +0900
committerYuya Kusakabe <yuya.kusakabe@gmail.com>2017-01-11 10:39:18 +0900
commit79060076f217eebf8f8e5f829bd035b47adef06a (patch)
tree7040038eb7778b7de803b8dc3a4fc9d13ad17d6a /spec/one_node
downloadvyos-integration-test-79060076f217eebf8f8e5f829bd035b47adef06a.tar.gz
vyos-integration-test-79060076f217eebf8f8e5f829bd035b47adef06a.zip
Initial commit
Diffstat (limited to 'spec/one_node')
-rw-r--r--spec/one_node/Vagrantfile28
-rw-r--r--spec/one_node/config.yaml2
-rw-r--r--spec/one_node/vyos_script.sh8
-rw-r--r--spec/one_node/vyos_spec.rb12
4 files changed, 50 insertions, 0 deletions
diff --git a/spec/one_node/Vagrantfile b/spec/one_node/Vagrantfile
new file mode 100644
index 0000000..03b9ff7
--- /dev/null
+++ b/spec/one_node/Vagrantfile
@@ -0,0 +1,28 @@
+require 'yaml'
+
+configs = YAML.load_file("config.yaml")
+
+Vagrant.configure("2") do |config|
+ config.vm.provider :libvirt do |libvirt|
+ libvirt.cpu_mode = 'host-passthrough'
+ end
+ configs.keys.each do |host|
+ config.vm.define host.to_sym do |c|
+ c.vm.box = "higebu/vyos"
+ c.vm.synced_folder "./", "/vagrant",
+ :owner => "vagrant",
+ :group => "vyattacfg",
+ :mount_options => ["dmode=775,fmode=775"]
+ c.vm.hostname = host
+ if !configs[host].nil? and configs[host].has_key? :networks
+ configs[host][:networks].keys.each do |net|
+ c.vm.network :private_network,
+ :ip => configs[host][:networks][net],
+ :libvirt__network_name => net,
+ :libvirt__dhcp_enabled => false
+ end
+ end
+ c.vm.provision "shell", path: "#{host}_script.sh"
+ end
+ end
+end
diff --git a/spec/one_node/config.yaml b/spec/one_node/config.yaml
new file mode 100644
index 0000000..cbf352d
--- /dev/null
+++ b/spec/one_node/config.yaml
@@ -0,0 +1,2 @@
+---
+vyos:
diff --git a/spec/one_node/vyos_script.sh b/spec/one_node/vyos_script.sh
new file mode 100644
index 0000000..edb0afe
--- /dev/null
+++ b/spec/one_node/vyos_script.sh
@@ -0,0 +1,8 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set system time-zone Asia/Tokyo
+
+commit
+save
diff --git a/spec/one_node/vyos_spec.rb b/spec/one_node/vyos_spec.rb
new file mode 100644
index 0000000..ec0e11f
--- /dev/null
+++ b/spec/one_node/vyos_spec.rb
@@ -0,0 +1,12 @@
+require_relative '../spec_helper'
+require 'serverspec_vyos_config'
+
+File.open('spec/one_node/vyos_script.sh') do |file|
+ file.each_line do |l|
+ if l.start_with?("set")
+ describe vyos_config(l.gsub(/set /, '')) do
+ it { should be_exists }
+ end
+ end
+ end
+end