Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load active incidents gracefully #129

Merged
merged 9 commits into from
Apr 19, 2024
Merged

Conversation

yhabteab
Copy link
Member

@yhabteab yhabteab commented Nov 21, 2023

resolves #119

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Nov 21, 2023
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch 3 times, most recently from eef0004 to 0bc598c Compare November 23, 2023 16:02
@yhabteab yhabteab marked this pull request as ready for review November 23, 2023 16:02
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch from 0bc598c to 93f985a Compare November 27, 2023 09:01
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch from 93f985a to 2b68ec4 Compare November 27, 2023 11:14
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch 4 times, most recently from 7924054 to c05571c Compare December 1, 2023 15:00
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch from c05571c to 2c72b11 Compare December 11, 2023 09:50
internal/incident/incidents.go Outdated Show resolved Hide resolved
internal/incident/incidents.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch 2 times, most recently from ce1947e to 82c7d48 Compare December 12, 2023 10:09
internal/incident/incidents.go Outdated Show resolved Hide resolved
internal/incident/incidents.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch from 82c7d48 to 1eb8a4c Compare March 25, 2024 08:18
@yhabteab yhabteab requested a review from oxzi April 12, 2024 09:21
internal/incident/incidents.go Outdated Show resolved Hide resolved
internal/incident/incidents.go Outdated Show resolved Hide resolved
internal/incident/incidents.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch from f46b60e to 5e25990 Compare April 15, 2024 07:53
Copy link
Collaborator

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, my just written unit tests were able to catch a serious bug 🐞

Well, I'd say they already paid off 😅

.github/workflows/sql.yml Outdated Show resolved Hide resolved
.github/workflows/sql.yml Outdated Show resolved Hide resolved
.github/workflows/sql.yml Outdated Show resolved Hide resolved
.github/workflows/sql.yml Outdated Show resolved Hide resolved
.github/workflows/sql.yml Outdated Show resolved Hide resolved
internal/incident/restore_incidents_test.go Outdated Show resolved Hide resolved
internal/incident/restore_incidents_test.go Outdated Show resolved Hide resolved
require.NoError(t, err, "database config validation should not fail")
}

db, err := c.Open(logging.NewLogger(zap.NewNop().Sugar(), time.Hour))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zap allows to create a logger for tests, have you considered using it? https://pkg.go.dev/go.uber.org/zap/zaptest#NewLogger

Copy link
Member Author

@yhabteab yhabteab Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really want Icinga Notifications to depend on the zaptest package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM! It's already there as part of zap main package.

internal/incident/restore_incidents_test.go Outdated Show resolved Hide resolved
internal/incident/restore_incidents_test.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch 4 times, most recently from 9c0e6e1 to c5b127b Compare April 18, 2024 12:17
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch from c5b127b to 370b303 Compare April 18, 2024 12:39
.github/workflows/tests_with_database.yml Outdated Show resolved Hide resolved
internal/object/object.go Outdated Show resolved Hide resolved
internal/incident/incidents.go Outdated Show resolved Hide resolved
internal/incident/restore_incidents_test.go Outdated Show resolved Hide resolved
internal/incident/restore_incidents_test.go Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch 3 times, most recently from 9d378db to 2108a18 Compare April 19, 2024 11:52
@yhabteab
Copy link
Member Author

Since we now utilise testing.T, require.** in a file that does not end with *_test.go, the go licence compliance failed due to the spew package, so I had to put this on the ignore list.

.github/workflows/compliance.yml Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the load-active-incidents-gracefully branch from 2108a18 to 8c14488 Compare April 19, 2024 13:07
@julianbrost julianbrost merged commit a67cd43 into main Apr 19, 2024
12 checks passed
@julianbrost julianbrost deleted the load-active-incidents-gracefully branch April 19, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve incident opening/loading code
3 participants