lib/testlab.rb in testlab-0.5.4 vs lib/testlab.rb in testlab-0.6.0
- old
+ new
@@ -160,18 +160,66 @@
# @return [Boolean] False is all nodes are running; true otherwise.
def dead?
!alive?
end
+ # Test Lab Up
+ #
+ # Attempts to up our lab topology. This calls the up method on all of
+ # our nodes.
+ #
+ # @return [Boolean] True if successful.
+ def up
+ @labfile.nodes.map do |node|
+ node.up
+ node.networks.map do |network|
+ network.up
+ end
+ node.containers.map do |container|
+ container.up
+ end
+ end
+
+ true
+ end
+
+ # Test Lab Down
+ #
+ # Attempts to down our lab topology. This calls the down method on all of
+ # our nodes.
+ #
+ # @return [Boolean] True if successful.
+ def down
+ @labfile.nodes.map do |node|
+ node.containers.map do |container|
+ container.down
+ end
+ node.networks.map do |network|
+ network.down
+ end
+ node.down
+ end
+
+ true
+ end
+
# Test Lab Setup
#
# Attempts to setup our lab topology. This calls the setup method on all of
# our nodes.
#
# @return [Boolean] True if successful.
def setup
- node_method_proxy(:setup)
+ @labfile.nodes.map do |node|
+ node.setup
+ node.networks.map do |network|
+ network.setup
+ end
+ node.containers.map do |container|
+ container.setup
+ end
+ end
true
end
# Test Lab Teardown
@@ -179,10 +227,18 @@
# Attempts to tearddown our lab topology. This calls the teardown method on
# all of our nodes.
#
# @return [Boolean] True if successful.
def teardown
- node_method_proxy(:teardown)
+ @labfile.nodes.map do |node|
+ node.containers.map do |container|
+ container.teardown
+ end
+ node.networks.map do |network|
+ network.teardown
+ end
+ node.teardown
+ end
true
end
# Node Method Proxy