README.md in infrataster-0.1.5 vs README.md in infrataster-0.1.6
- old
+ new
@@ -26,11 +26,11 @@
Create Vagrantfile:
```ruby
# Vagrantfile
-Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.define :proxy do |c|
c.vm.network "private_network", ip: "192.168.33.10"
c.vm.network "private_network", ip: "171.16.33.10", virtualbox__intnet: "infrataster-example"
@@ -144,9 +144,28 @@
Infrataster::Server.define(
# ...
ssh: {host: 'hostname', user: 'testuser', keys: ['/path/to/id_rsa']}
)
```
+
+### #ssh_exec
+
+You can execute a command on the server like the following:
+
+```ruby
+describe server(:proxy) do
+ let(:time) { Time.now }
+ before do
+ current_server.ssh_exec "echo 'Hello' > /tmp/test-#{time.to_i}"
+ end
+ it "executes a command on the current server" do
+ result = current_server.ssh_exec("cat /tmp/test-#{time.to_i}")
+ expect(result.chomp).to eq('Hello')
+ end
+end
+```
+
+This is useful to test cases which depends on the status of the server.
## Resources
"Resource" is what you test by Infrataster. For instance, the following code describes `http` resource.