Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #20 from nanliu/e2e
Browse files Browse the repository at this point in the history
Add end to end large tests with plugin tasks
  • Loading branch information
nanliu authored Sep 23, 2016
2 parents 115394b + 9300d25 commit 7e1cb44
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 49 deletions.
34 changes: 34 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# NOTE: override this via the option --provider {provider_name}
ENV["VAGRANT_DEFAULT_PROVIDER"] = "virtualbox"

Vagrant.configure(2) do |config|
operating_systems = %w{ centos72 }

operating_systems.each do |os|
config.vm.define os do |system|
system.vm.box = "boxcutter/#{os}"

$script = <<SCRIPT
curl -sfL https://raw.githubusercontent.com/intelsdi-x/snap-docker/master/install_snap | sudo bash
curl -sfL https://raw.githubusercontent.com/intelsdi-x/snap-docker/master/snapd.conf -o /etc/snap/snapd.conf
curl -sfL https://s3-us-west-2.amazonaws.com/snap.ci.snap-telemetry.io/plugins/snap-plugin-collector-ethtool/master/latest/linux/x86_64/snap-plugin-collector-ethtool -o /opt/snap/plugins/snap-plugin-collector-ethtool
curl -sfL https://s3-us-west-2.amazonaws.com/snap.ci.snap-telemetry.io/plugins/snap-plugin-publisher-file/master/latest/linux/x86_64/snap-plugin-publisher-file -o /opt/snap/plugins/snap-plugin-publisher-file
sudo /opt/snap/bin/snapd -t 0 -l 1 &
echo 'snap provision complete'
SCRIPT

config.vm.provision :shell, inline: $script

if Vagrant.has_plugin?("vagrant-serverspec")
config.vm.provision :serverspec do |spec|
spec.pattern = "spec/ethtool_spec.rb"
end
end
end
end
end
57 changes: 8 additions & 49 deletions examples/tasks/ethtool-file.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,14 @@
"workflow": {
"collect": {
"metrics": {
"/intel/net/ixgbe/eth0/nic/rx_packets": {},
"/intel/net/ixgbe/eth0/nic/rx_bytes": {},
"/intel/net/ixgbe/eth0/nic/tx_packets": {},
"/intel/net/ixgbe/eth0/nic/tx_bytes": {},
"/intel/net/ixgbe/eth0/nic/tx_fcoe_packets": {},
"/intel/net/ixgbe/eth1/nic/rx_packets": {},
"/intel/net/ixgbe/eth1/nic/rx_bytes": {},
"/intel/net/ixgbe/eth1/nic/tx_packets": {},
"/intel/net/ixgbe/eth1/nic/tx_bytes": {},
"/intel/net/ixgbe/eth1/nic/tx_fcoe_packets": {},

"/intel/net/e1000e/eno1/nic/rx_bytes": {},
"/intel/net/e1000e/eno1/nic/rx_errors": {},
"/intel/net/e1000e/eno1/nic/tx_bytes": {},
"/intel/net/e1000e/eno1/nic/tx_timeout_count": {},
"/intel/net/e1000e/eno1/nic/rx_errors": {},
"/intel/net/e1000e/eno1/nic/tx_bytes": {},
"/intel/net/e1000e/eno1/nic/tx_errors": {},

"/intel/net/tg3/eth2/nic/rx_1024_to_1522_octet_packets": {},
"/intel/net/tg3/eth2/nic/rx_1523_to_2047_octet_packets": {},
"/intel/net/tg3/eth2/nic/rx_2048_to_4095_octet_packets": {},
"/intel/net/tg3/eth2/nic/rx_octets": {},
"/intel/net/tg3/eth2/nic/tx_octets": {},
"/intel/net/tg3/eth3/nic/rx_1024_to_1522_octet_packets": {},
"/intel/net/tg3/eth3/nic/rx_1523_to_2047_octet_packets": {},
"/intel/net/tg3/eth3/nic/rx_2048_to_4095_octet_packets": {},
"/intel/net/tg3/eth3/nic/rx_octets": {},
"/intel/net/tg3/eth3/nic/tx_octets": {},

"/intel/net/ixgbe/eth0/reg/ARD": {},
"/intel/net/ixgbe/eth0/reg/CTRL": {},
"/intel/net/ixgbe/eth0/reg/link_speed": {},
"/intel/net/ixgbe/eth1/reg/ARD": {},
"/intel/net/ixgbe/eth1/reg/CTRL": {},
"/intel/net/ixgbe/eth1/reg/link_speed": {},
"/intel/net/ixgbe/enp4s0f1/dom/laser_bias_current": {},
"/intel/net/ixgbe/enp4s0f1/dom/laser_output_power": {},
"/intel/net/ixgbe/enp4s0f1/dom/laser_wavelength": {},
"/intel/net/ixgbe/enp4s0f1/dom/length_50um": {},
"/intel/net/ixgbe/enp4s0f1/dom/length_62.5um": {},
"/intel/net/ixgbe/enp4s0f1/dom/length_copper": {},
"/intel/net/ixgbe/enp4s0f1/dom/length_om3": {},
"/intel/net/ixgbe/enp4s0f1/dom/length_smf": {},
"/intel/net/ixgbe/enp4s0f1/dom/length_smf_km": {},
"/intel/net/ixgbe/enp4s0f1/dom/module_temperature": {},
"/intel/net/ixgbe/enp4s0f1/dom/module_voltage": {},
"/intel/net/ixgbe/enp4s0f1/dom/receiver_signal_average_optical_power": {},
"/intel/net/ixgbe/enp4s0f1/dom/br_nominal": {}
"/intel/net/e1000/*/nic/rx_bytes": {},
"/intel/net/e1000/*/nic/rx_errors": {},
"/intel/net/e1000/*/nic/rx_packets": {},
"/intel/net/e1000/*/nic/tx_bytes": {},
"/intel/net/e1000/*/nic/tx_errors": {},
"/intel/net/e1000/*/nic/tx_packets": {},
"/intel/net/e1000/*/reg/CTRL": {},
"/intel/net/e1000/*/reg/STATUS": {}
},
"config": {},
"process": null,
Expand Down
29 changes: 29 additions & 0 deletions spec/ethtool_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'spec_helper'

describe command("/opt/snap/bin/snapctl plugin load /opt/snap/plugins/snap-plugin-publisher-file") do
its(:exit_status) { should eq 0 }
end

describe command("/opt/snap/bin/snapctl plugin load /opt/snap/plugins/snap-plugin-collector-ethtool") do
its(:exit_status) { should eq 0 }
end

describe command("/opt/snap/bin/snapctl plugin list") do
its(:exit_status) { should eq 0 }
its(:stdout) { should match /file/ }
its(:stdout) { should match /ethtool/ }
end

describe command("/opt/snap/bin/snapctl task create -t /vagrant/examples/tasks/ethtool-file.json") do
its(:exit_status) { should eq 0 }
end

# NOTE: need some time to populate task
describe command("sleep 10") do
its(:exit_status) { should eq 0 }
end

describe file("/tmp/published_netstats") do
it { should be_file }
its(:content) { should match /rx_bytes/ }
end
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RSpec.configure do |config|
config.color = true
config.tty = true
config.formatter = :documentation # :progress, :html, :textmate
end

0 comments on commit 7e1cb44

Please sign in to comment.