From 41f0c063b25474badda2978f5930e978b940e4c1 Mon Sep 17 00:00:00 2001 From: Mauro Stettler Date: Wed, 8 May 2024 10:37:20 +0200 Subject: [PATCH] docs and test Signed-off-by: Mauro Stettler --- README.md | 4 +++- pkg/icassigner/config_test.go | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f57245..4242c43 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ teams: output: "slack-handle" ignoreLabels: - stale +unavailabilityLimit: 6h ``` #### Root configuration struct @@ -125,6 +126,7 @@ ignoreLabels: | -------------- | -------------------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ignoreLabels` | List of Strings | false | `[]` | List of labels which mark this issue to be ignored. If triggered on an issue which has at least **one** of the labels to be ignored, the action exits without doing something | | `teams` | Map of Team configurations | true | `nil` | Definition of the teams this issue is distributed between. | +| `unavailabilityLimit` | Duration | false | `6h` | Duration for which a calendar event must block someone's availability for them to be considered unavailable. | #### Team configuration struct @@ -176,4 +178,4 @@ Next members can share their availability with this service account via: 2. Open Settings by opening the hamburger menu next to your personal calendar and clicking `Settings and sharing` 3. In the `Share with specific people or groups` section you click `+ Add people and groups` 4. Enter the email address of the service account you created and select `See only free/busy (hide details)` under Permissions. -5. Click `Send` and you are done \ No newline at end of file +5. Click `Send` and you are done diff --git a/pkg/icassigner/config_test.go b/pkg/icassigner/config_test.go index a662987..1e71e01 100644 --- a/pkg/icassigner/config_test.go +++ b/pkg/icassigner/config_test.go @@ -19,6 +19,7 @@ package icassigner import ( "bytes" "testing" + "time" ) func TestMimirConfigCanBeParsed(t *testing.T) { @@ -38,7 +39,8 @@ func TestMimirConfigCanBeParsed(t *testing.T) { ical-url: https://tester2/basic.ics output: slack2 ignoreLabels: -- stale` // redacted excerpt from a real world config +- stale +unavailabilityLimit: 6h` // redacted excerpt from a real world config r := bytes.NewBuffer([]byte(rawConfig)) @@ -57,6 +59,10 @@ ignoreLabels: t.Fatal("Expected to find team \"mimir\", but got none") } + if cfg.UnavailabilityLimit != 6*time.Hour { + t.Error("Expected unavailability limit to be 6h, but got", cfg.UnavailabilityLimit) + } + expectedRequiredLabels := []string{"cloud-prometheus", "enterprise-metrics"} for i, e := range expectedRequiredLabels { if i >= len(team.RequireLabel) {