Skip to content

Commit

Permalink
docs and test
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Stettler <[email protected]>
  • Loading branch information
replay committed May 8, 2024
1 parent 23e3721 commit 41f0c06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ teams:
output: "slack-handle"
ignoreLabels:
- stale
unavailabilityLimit: 6h
```

#### Root configuration struct
Expand All @@ -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

Expand Down Expand Up @@ -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
5. Click `Send` and you are done
8 changes: 7 additions & 1 deletion pkg/icassigner/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package icassigner
import (
"bytes"
"testing"
"time"
)

func TestMimirConfigCanBeParsed(t *testing.T) {
Expand All @@ -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))

Expand All @@ -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) {
Expand Down

0 comments on commit 41f0c06

Please sign in to comment.