Skip to content

Commit 0404072

Browse files
committed
Merge pull request #13 from bjmllr/test
enhancements for testing
2 parents a8e536a + 62d6d0f commit 0404072

11 files changed

Lines changed: 54 additions & 7 deletions

File tree

README.textile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,16 @@ Have fun and let me know what needs to be fixed / added.
7272
== Testing
7373
You can invoke a series of minitest based spec test using the supplied
7474
tests and rake task. Simply run the following to kick off the tests
75-
@rake test@
75+
@bundle exec rake test@
7676

7777
You should see output similar to the following (The number of tests will
7878
of course grow over time):
7979
@3 tests, 6 assertions, 0 failures, 0 errors, 0 skips@
8080

8181
If you get any failures, you should of course address them
8282

83+
Since the test suite requires a working Zenoss installation to test against,
84+
some docker files are provided under test/docker. From a docker host, clone this
85+
repo, cd to the appropriate test/docker/ subdirectory, and run @sh start.sh@ to
86+
build and start the container. Once the container is running, you should be able
87+
to run the tests as described above.

Rakefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
require 'rubygems'
22
require 'rake/clean'
3-
require 'rake/gempackagetask'
4-
require 'rake/rdoctask'
3+
require 'rubygems/package_task'
4+
require 'rdoc/task'
55
require 'rake/testtask'
6+
require 'date'
67

78
CLEAN.include("pkg")
89
CLEAN.include("doc")
@@ -33,8 +34,8 @@ GEMSPEC = Gem::Specification.new do |gem|
3334
gem.add_runtime_dependency 'tzinfo'
3435
gem.post_install_message = "See README.rdoc"
3536
end
36-
37-
Rake::GemPackageTask.new(GEMSPEC) do |pkg|
37+
38+
Gem::PackageTask.new(GEMSPEC) do |pkg|
3839
pkg.need_tar = true
3940
end
4041

test/docker/3.2.1/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM centos:5
2+
RUN mkdir /opt/zenoss
3+
WORKDIR /opt/zenoss
4+
RUN yum -y install mysql-server net-snmp net-snmp-utils gmp \
5+
libgomp libgcj liberation-fonts libaio wget
6+
RUN wget http://downloads.sourceforge.net/project/zenoss/zenoss-3.2/zenoss-3.2.1/zenoss-3.2.1.el5.x86_64.rpm
7+
RUN service mysqld start && mysqladmin -u root password '' && \
8+
mysqladmin -u root -h localhost password ''
9+
RUN rpm -ivh ./zenoss-3.2.1.el5.x86_64.rpm
10+
RUN service zenoss start
11+
ADD remote_start.sh ./

test/docker/3.2.1/remote_start.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
service mysqld start
2+
service zenoss start
3+
tail -F /opt/zenoss/log/event.log

test/docker/3.2.1/start.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker build -t zen3.2.1 .
2+
docker run -i -p 8080:8080 -t zen3.2.1 sh remote_start.sh

test/docker/4.2.5/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM centos:6
2+
RUN mkdir /opt/zenoss
3+
WORKDIR /opt/zenoss
4+
RUN yum -y install wget which
5+
ADD https://raw.githubusercontent.com/zenoss/core-autodeploy/4.2.5/core-autodeploy.sh ./
6+
ADD https://raw.githubusercontent.com/zenoss/core-autodeploy/4.2.5/secure_zenoss.sh ./
7+
ADD https://raw.githubusercontent.com/zenoss/core-autodeploy/4.2.5/zenpack_actions.txt ./
8+
RUN chmod +x ./core-autodeploy.sh
9+
RUN echo -e "\ny\n" | ./core-autodeploy.sh
10+
ADD remote_start.sh ./

test/docker/4.2.5/remote_start.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
service zenoss start &
3+
service mysql start &
4+
service rabbitmq-server start
5+
rabbitmqctl stop_app
6+
rabbitmqctl reset
7+
rabbitmqctl start_app
8+
rabbitmqctl add_vhost "/zenoss"
9+
rabbitmqctl add_user zenoss \
10+
"$(sed -n 's/amqppassword \(.*\)/\1/p' /opt/zenoss/etc/global.conf)"
11+
rabbitmqctl set_permissions -p "/zenoss" zenoss ".*" ".*" ".*"
12+
tail -F /opt/zenoss/log/event.log

test/docker/4.2.5/start.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker build -t zen4.2.5 .
2+
docker run -i -p 8080:8080 -t zen4.2.5 sh remote_start.sh

test/test_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
22
#http://net.tutsplus.com/tutorials/ruby/ruby-for-newbies-testing-with-rspec/
33
require_relative '../lib/zenoss'
4-
require 'test/unit'
54

65

76
ZENOSS_URL = ENV['zenoss_client_url'] || "http://localhost:8080/zport/dmd"

test/zenoss_client_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require_relative './test_helper'
22
require 'minitest/spec'
3+
require 'minitest/autorun'
34
require 'logger'
45

56
LOG = Logger.new(STDOUT)

0 commit comments

Comments
 (0)