gruntwork-io / terratest

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.
https://terratest.gruntwork.io/
Apache License 2.0
7.44k stars 1.32k forks source link

Add 'serverspec'-like functionality #107

Open wjam opened 6 years ago

wjam commented 6 years ago

I've been using Terratest in anger recently and have had an idea about potential further functionality for the library.

As part of building an AMI, it's common to spin up the AMI once created in a test instance to test that the AMI contains all of the relevant changes, such as confirming that it contains the enhanced networking driver or that a piece of software that was installed can be started by systemd. Other solutions in this area would be something like serverspec.

My idea is about adding similar functionality to serverspec to Terratest to make it easier to verify the state of an instance, such as simplifying the querying of the group, encrypted password, etc of a user or querying the state of a service in systemd.

brikis98 commented 6 years ago

Would be a nice addition. One question, I suppose, is if we could just make it easy to integrate serverspec directly?

wjam commented 6 years ago

serverspec wouldn't be easy to integrate with due to the fact that it's written purely in Ruby. goss would be another alternative, as it is written in Ruby, but it's been written with the assumption that it'd be built as an executable and then run on the remote machine.

brikis98 commented 6 years ago

Well, Terratest already executes various binaries/scripts written in other languages: e.g., it runs terraform apply, packer build, and so on, using whatever happens to be installed on your OS. So I could see using Terratest to spin up various resources and then calling out to serverspec to validate those resources meet certain requirements.

berney commented 5 years ago

I use goss and really like its simplicity, the goss.yml files are nice and concise. Maybe terratest can have some helpers for calling out to goss, serverspec and the like.