Skip to content

Commit acaa7e1

Browse files
committed
Make changes backwards compatible
1 parent e091792 commit acaa7e1

7 files changed

Lines changed: 51 additions & 51 deletions

File tree

cmd/state-svc/internal/server/generated/generated.go

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/state-svc/schema/schema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ enum NotificationPlacementType {
5353

5454
type NotificationInfo {
5555
id: String!
56-
notification: String!
56+
message: String!
5757
condition: String!
5858
startDate: String!
5959
endDate: String!

cmd/state/internal/cmdtree/exechandlers/notifier/notifier.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ func (m *Notifier) PrintByPlacement(placement graph.NotificationPlacementType) e
9090
m.out.Notice("") // Line break after
9191
}
9292

93-
logging.Debug("Printing notification: %s, %s", notification.ID, notification.Notification)
94-
m.out.Notice(notification.Notification)
93+
logging.Debug("Printing notification: %s, %s", notification.ID, notification.Message)
94+
m.out.Notice(notification.Message)
9595

9696
if placement == graph.NotificationPlacementTypeBeforeCmd {
9797
m.out.Notice("") // Line break before

internal/constants/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ const VulnerabilitiesAPIPath = "/v13s/v1/graphql"
265265
const HasuraInventoryAPIPath = "/sv/hasura-inventory/v1/graphql"
266266

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

270270
// DateFormatUser is the date format we use when communicating with the end-user
271271
const DateFormatUser = "January 02, 2006"

internal/graph/generated.go

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/platform/api/svc/request/notification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (m *NotificationRequest) Query() string {
1616
return `query($command: String!, $flags: [String!]!) {
1717
checkNotifications(command: $command, flags: $flags) {
1818
id
19-
notification
19+
message
2020
interrupt
2121
placement
2222
}

test/integration/notification_int_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
4242
"Defaults",
4343
`[{
4444
"ID": "simple",
45-
"Notification": "This is a [NOTICE]simple[/RESET] notification"
45+
"Message": "This is a [NOTICE]simple[/RESET] notification"
4646
}]`,
4747
false,
4848
true,
@@ -51,7 +51,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
5151
"Repeat Hourly",
5252
`[{
5353
"ID": "simple",
54-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
54+
"Message": "This is a [NOTICE]simple[/RESET] notification",
5555
"Repeat": "Hourly"
5656
}]`,
5757
false,
@@ -61,7 +61,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
6161
"Repeat Constantly",
6262
`[{
6363
"ID": "simple",
64-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
64+
"Message": "This is a [NOTICE]simple[/RESET] notification",
6565
"Repeat": "Constantly"
6666
}]`,
6767
true,
@@ -71,7 +71,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
7171
"Within Date Range",
7272
fmt.Sprintf(`[{
7373
"ID": "simple",
74-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
74+
"Message": "This is a [NOTICE]simple[/RESET] notification",
7575
"StartDate": "%s",
7676
"EndDate": "%s"
7777
}]`,
@@ -84,7 +84,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
8484
"Outside Date Range",
8585
fmt.Sprintf(`[{
8686
"ID": "simple",
87-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
87+
"Message": "This is a [NOTICE]simple[/RESET] notification",
8888
"StartDate": "%s",
8989
"EndDate": "%s"
9090
}]`,
@@ -97,7 +97,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
9797
"Only Start Date - Inside Range",
9898
fmt.Sprintf(`[{
9999
"ID": "simple",
100-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
100+
"Message": "This is a [NOTICE]simple[/RESET] notification",
101101
"StartDate": "%s"
102102
}]`,
103103
time.Now().Add(-1*time.Hour).Format(time.RFC3339)),
@@ -108,7 +108,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
108108
"Only End Date - Inside Range",
109109
fmt.Sprintf(`[{
110110
"ID": "simple",
111-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
111+
"Message": "This is a [NOTICE]simple[/RESET] notification",
112112
"EndDate": "%s"
113113
}]`,
114114
time.Now().Add(1*time.Hour).Format(time.RFC3339)),
@@ -119,7 +119,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
119119
"Outside Date Range - Future",
120120
fmt.Sprintf(`[{
121121
"ID": "simple",
122-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
122+
"Message": "This is a [NOTICE]simple[/RESET] notification",
123123
"StartDate": "%s",
124124
"EndDate": "%s"
125125
}]`,
@@ -132,7 +132,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
132132
"Outside Date Range - Past",
133133
fmt.Sprintf(`[{
134134
"ID": "simple",
135-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
135+
"Message": "This is a [NOTICE]simple[/RESET] notification",
136136
"StartDate": "%s",
137137
"EndDate": "%s"
138138
}]`,
@@ -145,7 +145,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
145145
"Only Start Date - Outside Range",
146146
fmt.Sprintf(`[{
147147
"ID": "simple",
148-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
148+
"Message": "This is a [NOTICE]simple[/RESET] notification",
149149
"StartDate": "%s"
150150
}]`,
151151
time.Now().Add(1*time.Hour).Format(time.RFC3339)),
@@ -156,7 +156,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
156156
"Only End Date - Outside Range",
157157
fmt.Sprintf(`[{
158158
"ID": "simple",
159-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
159+
"Message": "This is a [NOTICE]simple[/RESET] notification",
160160
"EndDate": "%s"
161161
}]`,
162162
time.Now().Add(-1*time.Hour).Format(time.RFC3339)),
@@ -169,7 +169,7 @@ func (suite *NotificationIntegrationTestSuite) TestNotification_Basic() {
169169
ts := e2e.New(suite.T(), false)
170170
defer ts.Close()
171171

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

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

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

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

256-
msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "notifications.json", []byte(fmt.Sprintf(`[
256+
msgFile, err := fileutils.WriteTempFileToDir(ts.Dirs.Work, "messages.json", []byte(fmt.Sprintf(`[
257257
{
258258
"ID": "simple",
259-
"Notification": "This is a [NOTICE]simple[/RESET] notification",
259+
"Message": "This is a [NOTICE]simple[/RESET] notification",
260260
"Interrupt": "%s"
261261
}
262262
]`, graph.NotificationInterruptTypeExit)), 0755)

0 commit comments

Comments
 (0)