From f19882fabbc31dbdbb10d7b6fdebfd33fafd97ac Mon Sep 17 00:00:00 2001 From: Jordan Neufeld Date: Thu, 10 Mar 2022 09:14:40 -0600 Subject: [PATCH] Update release documentation and fix test(#369) * update release documentation Co-authored-by: Michael Nikitochkin * remove link after metrics test attempt to address race condition in tests that happens in CI Co-authored-by: Michael Nikitochkin --- README.md | 5 +--- RELEASE.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ metrics_test.go | 4 ++- 3 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 RELEASE.md diff --git a/README.md b/README.md index 332c1fa1..f0a4530b 100644 --- a/README.md +++ b/README.md @@ -616,9 +616,6 @@ For example, `shopify_test_redis_master` or `shopify_development_mysql_1`. ### Release -1. Update `CHANGELOG.md` -1. Change versions in `README.md` -1. Create a release commit and a signed tag. -1. [Bump version for Homebrew](https://github.com/Shopify/homebrew-shopify/blob/master/toxiproxy.rb#L9) +See [RELEASE.md](./RELEASE.md) [blog]: https://shopifyengineering.myshopify.com/blogs/engineering/building-and-testing-resilient-ruby-on-rails-applications diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..9990f1a1 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,77 @@ +# Releasing + +- [Releasing](#releasing) + - [Before You Begin](#before-you-begin) + - [Local Release Preparation](#local-release-preparation) + - [Checkout latest code](#checkout-latest-code) + - [Update the CHANGELOG.md](#update-the-changelogmd) + - [Create Release Commit and Tag](#create-release-commit-and-tag) + - [Run Pre-Release Tests](#run-pre-release-tests) + - [Push Release Tag](#push-release-tag) + - [Verify Github Release](#verify-github-release) + - [Update Homebrew versions](#update-homebrew-versions) + +## Before You Begin + +Ensure your local workstation is configured to be able to [Sign commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) + +## Local Release Preparation + +### Checkout latest code + +```bash +git checkout master +git pull origin master +``` + +### Update the [CHANGELOG.md](CHANGELOG.md) + +- Add a new version header at the top of the document, just after `# [Unreleased]` +- Update links at bottom of changelog + +### Create Release Commit and Tag + +```bash +export RELEASE_VERSION=2.x.y +git commit -a -S -m "Release $RELEASE_VERSION" +git tag -s "v$RELEASE_VERSION" # When prompted for a commit message, enter the 'release notes' style message, just like on the releases page +``` + +### Run Pre-Release Tests + +```bash +make test-release +``` + +- Push to Master Branch +```bash +git push origin master +``` + +## Push Release Tag + +- On your local machine again, push your tag to github + +```bash +git push origin "v$RELEASE_VERSION" +``` + +## Verify Github Release + +- Github Actions should kick off a build and release after the tag is pushed. +- Verify that a [Release gets created in Github](https://github.com/Shopify/toxiproxy/releases) and verify that the release notes look correct +- Github Actions should also attatch the built binaries to the release (it might take a few mins) + +## Update Homebrew versions + +- Update [homebrew-shopify toxiproxy.rb](https://github.com/Shopify/homebrew-shopify/blob/master/toxiproxy.rb#L9) manifest + 1. Update `app_version` string to your released version + 2. Update hashes for all platforms (find the hashes in the checksums.txt from your release notes) + +- Do a manual check of installing toxiproxy via brew + 1. While in the homebrew-shopify directory... + ```bash + brew install ./toxiproxy.rb --debug + ``` + Note: it's normal to get some errors when homebrew attempts to load the file as a Cask instead of a formula, just make sure that it still gets installed. +- PR the version update change and merge diff --git a/metrics_test.go b/metrics_test.go index f83ffcde..98904e9f 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -30,7 +30,9 @@ func TestProxyMetricsReceivedSentBytes(t *testing.T) { w := &testWriteCloser{ bufio.NewWriter(bytes.NewBuffer([]byte{})), } - proxy.Toxics.StartLink(srv, "testupstream", r, w, stream.Upstream) + linkName := "testupstream" + proxy.Toxics.StartLink(srv, linkName, r, w, stream.Upstream) + proxy.Toxics.RemoveLink(linkName) gotMetrics := prometheusOutput(t, srv, "toxiproxy") if !reflect.DeepEqual(gotMetrics, expectedMetrics) { t.Fatalf("expected: %v got: %v", expectedMetrics, gotMetrics)