{"id":13626308,"url":"https://github.com/thisendout/shrift","last_synced_at":"2026-01-18T02:41:08.645Z","repository":{"id":35576961,"uuid":"39849266","full_name":"thisendout/shrift","owner":"thisendout","description":"A minimal spec framework for running tests against your environment","archived":false,"fork":false,"pushed_at":"2015-08-18T17:28:48.000Z","size":1207,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-08T16:43:01.219Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://shrift.io","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thisendout.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-28T17:53:00.000Z","updated_at":"2017-08-09T02:43:59.000Z","dependencies_parsed_at":"2022-09-18T01:00:44.370Z","dependency_job_id":null,"html_url":"https://github.com/thisendout/shrift","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisendout%2Fshrift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisendout%2Fshrift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisendout%2Fshrift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisendout%2Fshrift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisendout","download_url":"https://codeload.github.com/thisendout/shrift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249250820,"owners_count":21237961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:02:15.164Z","updated_at":"2026-01-18T02:41:08.617Z","avatar_url":"https://github.com/thisendout.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# shrift\n[![Circle CI](https://circleci.com/gh/thisendout/shrift.svg?style=svg)](https://circleci.com/gh/thisendout/shrift)\n\nshrift is a minimal spec framework for testing your infrastructure using bash.\nshrift installs as a single script and executes bash one-liners as a test suite.\nNo complex setup.  No DSL.\n\n# Quickstart\n\nDownload \u003ccode\u003eshrift\u003c/code\u003e.\n```\n# download the script\n$ curl -L -o shrift https://github.com/thisendout/shrift/raw/master/shrift\n# make executable\n$ chmod +x shrift\n```\n\nWrite and run your first spec.\n\n```\n# write a passing test\n$ echo \"test -x ./shrift\" \u003e test_spec.sh\n# execute with shrift\n$ ./shrift test_spec.sh\n```\n\n# Documentation\n\n## Spec Files\n\nBy default, `shrift` searches for files matching *_spec.sh in the current directory.  You can pass a space-separated list of paths to shrift to expand the suite.\n\n```\n$ ./shrift specs                      # _spec.sh files in a sub-directory\n$ ./shrift specs/{common,web}         # _spec.sh split up by role, one per directory\n$ ./shrift specs/{common,web}_spec.sh # _spec.sh split up by role, one per file\n$ ./shrift specs/**/*.sh              # globbing and wilcards are supported\n```\n\n## Specs\n\nSpec files must contain one test per line.  A test is considered passing when the return code is `0`. Any other condition is considered a failure.\n\n```\n# example spec file\ntest -f /etc/passwd\nwhoami | grep root\n/usr/local/bin/my_test_script\nnetstat -lntp | grep 80\n```\n\n### Functions\n\nSpec files may source a functions file or contain user-defined inline functions (contained on a single line) to encapsulate commonly used commands. For example, if there were a number of spec's checking for individual ports, instead of repeating the command, a one-liner function could be used instead.\n\n```\n# before function\nnetstat -lntp | grep 22\nnetstat -lntp | grep 80\nnetstat -lntp | grep 443\n\n# define function\nport() { netstat -lntp | grep $1; }\n\n# after function\nport 22\nport 80\nport 443\n```\n\nSourcing a common functions file is also a supported workflow. For example:\n\n```\n# my_functions.sh\nfunction port() { netstat -lntp | grep $1; }\nprocess() { ps ax | grep $1; }\nmode() { stat -c \"%a\" $1 | grep $2; }\n\n# my_spec.sh\nsource my_functions.sh\nport 22\nprocess sshd\nmode /etc/passwd 644\n```\n\n## Targets\n\nBy default, `shrift` executes the specs locally.  shrift can also execute using docker exec and ssh, if the clients are already installed.\n\n```\n$ ./shrift -d [container_id]  # Run specs against a *running* container\n$ ./shrift -s [hostname]      # Run specs against a remote host via SSH\n```\n\nFor docker and ssh backends, custom client-specific options can be passed using `-o 'opts...'`.\n\nFor the ssh backends, each spec is executed using a separate ssh command. We recommend setting up ControlMaster and ControlPersist to re-use ssh sessions.\n\n## Output\n\nBy default, `shrift` shows output from failing tests and a summary.  If you want to see the output from all tests, set the verbose flag by passing `-v`.\n\n### Blocks\n\nA `#` comment line will start a new test block.  `shrift` will add subsequent tests to the block until another comment or empty line is encountered.  Blocks are only used in formatting output; they do not modify how the tests are executed.\n\n# License\n\nMIT License\n\n\u0026copy; 2015 This End Out, LLC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisendout%2Fshrift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisendout%2Fshrift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisendout%2Fshrift/lists"}