Golang application focused on tests

Maceio

Golang application that listens for webhook events coming from Github, runs tests previously defined in a configuration file and returns the output to a pull request.

What does it do?

It runs a list of tests defined in a YAML file, located in the application's repository. Maceio currently supports the following test types:

  • Custom
  • Kubeval
  • Pytest
  • RSpec
  • Rake
  • Terraform

The custom type can run any command present on Alpine. For instance, this would be the right check if you need to run gem or pip3. For more information, check the Dockerfile in this repository.

Your pull request will have the test output, check the image below: test result

Configuring your repository

Add the configuration file

Add the maceio.yaml file to your repository, the structure should look like the one below:

├── app
│   ├── css
│   │   ├── **/*.css
│   ├── favicon.ico
│   ├── images
│   ├── js
│   │   ├── **/*.js
│   └── partials/template
├── maceio.yaml
├── README.md
├── package.json
└── .gitignore

Add the webhook

  • Payload URL: https://YOUR_URL/webhook
  • Content type: application/json
  • Secret: Secret created with the command ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'
  • Which events would you like to trigger this webhook: Select Pull requests and Pushes

Personal access tokens

Create a user and follow this guide and select the scopes repo and admin:repo_hook.

Configuration file

Some examples of the maceio.yaml file can be found below.

Terraform

---
tests:
  - name: tf_validate
    cmd: terraform validate
  - name: tf_plan
    cmd: terraform plan

We do not think you should add the apply parameter from terraform to the tests, but remember to add the flag -auto-approve if you decide to do it

Rspec

---
tests:
  - name: "Build test"
    cmd: "rspec spec hello_world.rb"

Pytest

---
tests:
  - name: "Pytest local"
    cmd: pytest

Kubeval

---
tests:
  - name: "Kubernetes syntax"
    cmd: kubeval deployment.yaml

Custom

---
tests:
  - name: "Install mathutils"
    cmd: pip3 install mathutils
  - name: "Pytest local"
    cmd: pytest

The cmd specified in the configuration file will be executed in the root directory of the application repository.

Running it

You can choose one of the two options below to run the application.

From Github

The version you will find in Github may be unstable. It is not recommended for production.

Clone the repository:

git clone https://github.com/leodamasceno/maceio.git
cd maceio

Build the image locally:

docker build -t "maceio:0.1" .

Run it:

docker run --name maceio -p 8080:8080 \
-e GIT_TOKEN="*YOUR_GIT_TOKEN*" \
-e GIT_SECRET="*YOUR_GIT_SECRET*" maceio:0.1

From DockerHub

Run it:

docker run --name maceio -p 8080:8080 \
-e GIT_TOKEN="*YOUR_GIT_TOKEN*" \
-e GIT_SECRET="*YOUR_GIT_SECRET*" leodamasceno/maceio:latest
Owner
Similar Resources

A next-generation testing tool. Orion provides a powerful DSL to write and automate your acceptance tests

Orion is born to change the way we implement our acceptance tests. It takes advantage of HCL from Hashicorp t o provide a simple DSL to write the acceptance tests.

Aug 31, 2022

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code. It provides a variety of helper functions and patterns for common infrastructure testing tasks,

Dec 30, 2022

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

GoConvey is awesome Go testing Welcome to GoConvey, a yummy Go testing tool for gophers. Works with go test. Use it in the terminal or browser accordi

Dec 30, 2022

gostub is a library to make stubbing in unit tests easy

gostub gostub is a library to make stubbing in unit tests easy. Getting started Import the following package: github.com/prashantv/gostub Click here t

Dec 28, 2022

Robust framework for running complex workload scenarios in isolation, using Go; for integration, e2e tests, benchmarks and more! 💪

e2e Go Module providing robust framework for running complex workload scenarios in isolation, using Go and Docker. For integration, e2e tests, benchma

Jan 5, 2023

gomonkey is a library to make monkey patching in unit tests easy

gomonkey is a library to make monkey patching in unit tests easy, and the core idea of monkey patching comes from Bouke, you can read this blogpost for an explanation on how it works.

Jan 4, 2023

A simple and expressive HTTP server mocking library for end-to-end tests in Go.

mockhttp A simple and expressive HTTP server mocking library for end-to-end tests in Go. Installation go get -d github.com/americanas-go/mockhttp Exa

Dec 19, 2021

How we can run unit tests in parallel mode with failpoint injection taking effect and without injection race

This is a simple demo to show how we can run unit tests in parallel mode with failpoint injection taking effect and without injection race. The basic

Oct 31, 2021

Package has tool to generate workload for vegeta based kube-api stress tests.

Package has tool to generate workload for vegeta based kube-api stress tests.

Nov 22, 2021
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Dec 22, 2022
S3 etag tests for golang

S3-etag-tests Quickstart Run docker-compose up. Execute tests in /test with $ go

Dec 16, 2021
Behaviour Driven Development tests generator for Golang
Behaviour Driven Development tests generator for Golang

gherkingen It's a Behaviour Driven Development (BDD) tests generator for Golang. It accept a *.feature Cucumber/Gherkin file and generates a test boil

Dec 16, 2022
Package for comparing Go values in tests

Package for equality of Go values This package is intended to be a more powerful and safer alternative to reflect.DeepEqual for comparing whether two

Dec 29, 2022
Record and replay your HTTP interactions for fast, deterministic and accurate tests

go-vcr go-vcr simplifies testing by recording your HTTP interactions and replaying them in future runs in order to provide fast, deterministic and acc

Dec 25, 2022
Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

GoConvey is awesome Go testing Welcome to GoConvey, a yummy Go testing tool for gophers. Works with go test. Use it in the terminal or browser accordi

Dec 30, 2022
Testing framework for Go. Allows writing self-documenting tests/specifications, and executes them concurrently and safely isolated. [UNMAINTAINED]

GoSpec GoSpec is a BDD-style testing framework for the Go programming language. It allows writing self-documenting tests/specs, and executes them in p

Nov 28, 2022
Ruby on Rails like test fixtures for Go. Write tests against a real database

testfixtures Warning: this package will wipe the database data before loading the fixtures! It is supposed to be used on a test database. Please, doub

Jan 8, 2023
Automatically update your Go tests

autogold - automatically update your Go tests autogold makes go test -update automatically update your Go tests (golden files and Go values in e.g. fo

Dec 25, 2022
A simple `fs.FS` implementation to be used inside tests.

testfs A simple fs.FS which is contained in a test (using testing.TB's TempDir()) and with a few helper methods. PS: This lib only works on Go 1.16+.

Mar 3, 2022