瀏覽代碼

Added first tests for mapserver role

Till Klocke 9 年之前
父節點
當前提交
a56d0752b9

+ 5 - 5
.kitchen.yml

@@ -17,7 +17,7 @@ platforms:
         box: debian/jessie64
     - name: Debian-wheezy
       driver:
-        box: debian/wheezy64 #chef/debian-7.8
+        box: debian/wheezy64
     - name: Ubuntu-trusty
       driver:
         box: ubuntu/trusty64
@@ -27,7 +27,7 @@ suites:
     provisioner:
       playbook: "test/application/supernode.yml"
       extra_vars: {'kitchen_connection': 'smart'}
-#  - name            : group
-#    provisioner     :
-#        playbook    : "test/application/group.yml"
-#        extra_vars  : { 'kitchen_connection': 'smart' }
+  - name: mapserver
+    provisioner:
+      playbook: "test/application/mapserver.yml"
+      extra_vars: {'kitchen_connection': 'smart'}

+ 10 - 0
test/application/mapserver.yml

@@ -0,0 +1,10 @@
+---
+- name         : Create and configure a Freifunk map server
+  hosts        : all
+  gather_facts : yes
+  #sudo         : no
+  connection   : "{{ kitchen_connection | default('local') }}"
+  vars_files   :
+                 - "mapserver_pkg_vars.yml"
+  roles        :
+                 - "map-server"

+ 70 - 0
test/application/mapserver_pkg_vars.yml

@@ -0,0 +1,70 @@
+supernodes:
+  - name: node01
+    public_ip: 192.168.77.21/24
+    mesh_ip_v4: 10.42.0.8/16
+    mesh_ip_v6: fdec:16a3:681b:865c::8/64
+    mesh_mac: 96:48:76:b5:a3:61
+    bat_mac: f2:43:13:c0:d7:06
+    dhcp_range_start: 10.42.0.32
+    dhcp_range_end: 10.42.5.254
+    public_interface: eth1
+    uplink_tunnel_ip: 172.16.42.2/30
+    uplink_tunnel_ip_v6: fd30:db1d:2377:4143::2/64
+  - name: node02
+    public_ip: 192.168.77.22/24
+    mesh_ip_v4: 10.42.0.16/16
+    mesh_ip_v6: fdec:16a3:681b:865c::16/64
+    mesh_mac: c2:e1:c6:e5:68:4c
+    bat_mac: 1e:f5:dc:71:bb:5f
+    dhcp_range_start: 10.42.6.2
+    dhcp_range_end: 10.42.8.254
+    public_interface: eth1
+  - name: map
+    public_ip: 192.168.77.29/24
+    mesh_ip_v4: 10.42.0.128/16
+    mesh_ip_v6: fdec:16a3:681b:865c::80/64
+    mesh_mac: 12:78:92:f8:1b:42
+    bat_mac: f6:9c:fe:9d:d4:da
+    public_interface: eth1
+
+
+local_node: "{{supernodes[2]}}"
+
+supernode_mesh_mac: "{{local_node.mesh_mac}}"
+supernode_mesh_ipv4: "{{local_node.mesh_ip_v4}}"
+supernode_bat_macaddress: "{{local_node.bat_mac}}"
+supernode_mesh_ipv6: "{{local_node.mesh_ip_v6}}"
+supernode_local_ip: "{{local_node.public_ip|default(ansible_default_ipv4.address)}}"
+supernode_public_interface: "{{local_node.public_interface|default(ansible_default_ipv4.interface)}}"
+supernode_as: '4242'
+
+supernode_mesh_backbones:
+  - name: "{{supernodes[0].name}}"
+    remote_ip: "{{supernodes[0].public_ip|ipaddr('address')}}"
+    mesh_ip: "{{supernodes[0].mesh_ip_v4|ipaddr('address')}}"
+    address_v6: "{{supernodes[0].mesh_ip_v6|ipaddr('address')}}"
+    local_ip: "{{supernode_local_ip|ipaddr('address')}}"
+    interface: "{{supernode_public_interface}}"
+  - name: "{{supernodes[1].name}}"
+    remote_ip: "{{supernodes[1].public_ip|ipaddr('address')}}"
+    mesh_ip: "{{supernodes[1].mesh_ip_v4|ipaddr('address')}}"
+    address_v6: "{{supernodes[1].mesh_ip_v6|ipaddr('address')}}"
+    local_ip: "{{supernode_local_ip|ipaddr('address')}}"
+    interface: "{{supernode_public_interface}}"
+
+supernode_interfaces:
+  - name: eth0
+    auto: true
+    proto: inet
+    type: dhcp
+  - name: eth1
+    auto: true
+    proto: inet
+    type: static
+    config:
+    - key: address
+      value: "{{supernode_local_ip|ipaddr('address')}}"
+    - key: netmask
+      value: "{{supernode_local_ip|ipaddr('netmask')}}"
+    - key: broadcast
+      value: "{{supernode_local_ip|ipaddr('broadcast')}}"

+ 17 - 0
test/integration/mapserver/serverspec/network_spec.rb

@@ -0,0 +1,17 @@
+require 'serverspec'
+
+describe interface('meshdummy0') do
+  it { should exist }
+end
+
+describe interface('alfred0') do
+  it { should exist }
+end
+
+describe interface('bat0') do
+  it { should exist }
+end
+
+describe interface('eth0') do
+  it { should exist }
+end

+ 9 - 0
test/integration/mapserver/serverspec/test_spec.rb

@@ -0,0 +1,9 @@
+require 'serverspec'
+
+# Required by serverspec
+set :backend, :exec
+
+describe file('/usr/local/bin/alfred-json') do
+  it { should exist }
+  it { should be_executable }
+end