Skip to content

Commit

Permalink
Make changes backwards compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
MDrakos committed Nov 21, 2024
1 parent e091792 commit acaa7e1
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 51 deletions.
40 changes: 20 additions & 20 deletions cmd/state-svc/internal/server/generated/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/state-svc/schema/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum NotificationPlacementType {

type NotificationInfo {
id: String!
notification: String!
message: String!
condition: String!
startDate: String!
endDate: String!
Expand Down
4 changes: 2 additions & 2 deletions cmd/state/internal/cmdtree/exechandlers/notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ func (m *Notifier) PrintByPlacement(placement graph.NotificationPlacementType) e
m.out.Notice("") // Line break after
}

logging.Debug("Printing notification: %s, %s", notification.ID, notification.Notification)
m.out.Notice(notification.Notification)
logging.Debug("Printing notification: %s, %s", notification.ID, notification.Message)
m.out.Notice(notification.Message)

if placement == graph.NotificationPlacementTypeBeforeCmd {
m.out.Notice("") // Line break before
Expand Down
2 changes: 1 addition & 1 deletion internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const VulnerabilitiesAPIPath = "/v13s/v1/graphql"
const HasuraInventoryAPIPath = "/sv/hasura-inventory/v1/graphql"

// NotificationsInfoURL is the URL we check against to see what versions are deprecated
const NotificationsInfoURL = "https://state-tool.s3.amazonaws.com/notifications.json"
const NotificationsInfoURL = "https://state-tool.s3.amazonaws.com/messages.json"

// DateFormatUser is the date format we use when communicating with the end-user
const DateFormatUser = "January 02, 2006"
Expand Down
16 changes: 8 additions & 8 deletions internal/graph/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/platform/api/svc/request/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (m *NotificationRequest) Query() string {
return `query($command: String!, $flags: [String!]!) {
checkNotifications(command: $command, flags: $flags) {
id
notification
message
interrupt
placement
}
Expand Down
36 changes: 18 additions & 18 deletions test/integration/notification_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Defaults",
`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification"
"Message": "This is a [NOTICE]simple[/RESET] notification"
}]`,
false,
true,
Expand All @@ -51,7 +51,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Repeat Hourly",
`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"Repeat": "Hourly"
}]`,
false,
Expand All @@ -61,7 +61,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Repeat Constantly",
`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"Repeat": "Constantly"
}]`,
true,
Expand All @@ -71,7 +71,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Within Date Range",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"StartDate": "%s",
"EndDate": "%s"
}]`,
Expand All @@ -84,7 +84,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Outside Date Range",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"StartDate": "%s",
"EndDate": "%s"
}]`,
Expand All @@ -97,7 +97,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Only Start Date - Inside Range",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"StartDate": "%s"
}]`,
time.Now().Add(-1*time.Hour).Format(time.RFC3339)),
Expand All @@ -108,7 +108,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Only End Date - Inside Range",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"EndDate": "%s"
}]`,
time.Now().Add(1*time.Hour).Format(time.RFC3339)),
Expand All @@ -119,7 +119,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Outside Date Range - Future",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"StartDate": "%s",
"EndDate": "%s"
}]`,
Expand All @@ -132,7 +132,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Outside Date Range - Past",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"StartDate": "%s",
"EndDate": "%s"
}]`,
Expand All @@ -145,7 +145,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Only Start Date - Outside Range",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"StartDate": "%s"
}]`,
time.Now().Add(1*time.Hour).Format(time.RFC3339)),
Expand All @@ -156,7 +156,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
"Only End Date - Outside Range",
fmt.Sprintf(`[{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"EndDate": "%s"
}]`,
time.Now().Add(-1*time.Hour).Format(time.RFC3339)),
Expand All @@ -169,7 +169,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
ts := e2e.New(suite.T(), false)
defer ts.Close()

msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "notifications.json", []byte(tt.MessageJson), 0755)
msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "messages.json", []byte(tt.MessageJson), 0755)
suite.Require().NoError(err)

cp := ts.SpawnWithOpts(e2e.OptArgs("--version"), e2e.OptAppendEnv(constants.NotificationsOverrideEnvVarName+"="+msgFile))
Expand Down Expand Up @@ -201,10 +201,10 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic_PlacementA
ts := e2e.New(suite.T(), false)
defer ts.Close()

msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "notifications.json", []byte(fmt.Sprintf(`[
msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "messages.json", []byte(fmt.Sprintf(`[
{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"Placement": "%s"
}
]`, graph.NotificationPlacementTypeAfterCmd)), 0755)
Expand All @@ -221,10 +221,10 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic_InterruptP
ts := e2e.New(suite.T(), false)
defer ts.Close()

msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "notifications.json", []byte(fmt.Sprintf(`[
msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "messages.json", []byte(fmt.Sprintf(`[
{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"Repeat": "Constantly",
"Interrupt": "%s"
}
Expand Down Expand Up @@ -253,10 +253,10 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic_InterruptE
ts := e2e.New(suite.T(), false)
defer ts.Close()

msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "notifications.json", []byte(fmt.Sprintf(`[
msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "messages.json", []byte(fmt.Sprintf(`[
{
"ID": "simple",
"Notification": "This is a [NOTICE]simple[/RESET] notification",
"Message": "This is a [NOTICE]simple[/RESET] notification",
"Interrupt": "%s"
}
]`, graph.NotificationInterruptTypeExit)), 0755)
Expand Down

0 comments on commit acaa7e1

Please sign in to comment.