-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ func TestGrafanaCloudLogsCreate(t *testing.T) { | |
wantOutput string | ||
}{ | ||
{ | ||
args: args("logging grafanacloudlogs create --service-id 123 --version 1 --name log --user 123456 --url https://test123.grafana.net --token testtoken --index `{\"label\": \"value\" }` --autoclone"), | ||
args: args("logging grafanacloudlogs create --service-id 123 --version 1 --name log --user 123456 --url https://test123.grafana.net --auth-token testtoken --index `{\"label\": \"value\" }` --autoclone"), | ||
api: mock.API{ | ||
ListVersionsFn: testutil.ListVersions, | ||
CloneVersionFn: testutil.CloneVersionResult(4), | ||
|
@@ -32,7 +32,7 @@ func TestGrafanaCloudLogsCreate(t *testing.T) { | |
wantOutput: "Created Grafana Cloud Logs logging endpoint log (service 123 version 4)", | ||
}, | ||
{ | ||
args: args("logging grafanacloudlogs create --service-id 123 --version 1 --name log --url https://test123.grafana.net --token testtoken --index `{\"label\": \"value\" }` --autoclone"), | ||
args: args("logging grafanacloudlogs create --service-id 123 --version 1 --name log --url https://test123.grafana.net --auth-token testtoken --index `{\"label\": \"value\" }` --autoclone"), | ||
api: mock.API{ | ||
ListVersionsFn: testutil.ListVersions, | ||
CloneVersionFn: testutil.CloneVersionResult(4), | ||
|
@@ -203,7 +203,7 @@ func TestGrafanaCloudLogsUpdate(t *testing.T) { | |
CloneVersionFn: testutil.CloneVersionResult(4), | ||
UpdateGrafanaCloudLogsFn: updateGrafanaCloudLogsOK, | ||
}, | ||
wantOutput: "Updated grafanacloudlogs logging endpoint log (service 123 version 4)", | ||
wantOutput: "Updated Grafana Cloud Logs logging endpoint log (service 123 version 4)", | ||
}, | ||
} | ||
for testcaseIdx := range scenarios { | ||
|
@@ -333,42 +333,32 @@ Fastly API token provided via config file (profile: user) | |
Service ID (via --service-id): 123 | ||
Version: 1 | ||
GCS 1/2 | ||
GrafanaCloudLogs 1/2 | ||
Service ID: 123 | ||
Version: 1 | ||
Name: logs | ||
Bucket: my-logs | ||
User: [email protected] | ||
Account name: [email protected] | ||
Secret key: -----BEGIN RSA PRIVATE KEY-----foo | ||
Path: logs/ | ||
Period: 3600 | ||
GZip level: 0 | ||
Format: %h %l %u %t "%r" %>s %b | ||
Format version: 2 | ||
Response condition: Prevent default logging | ||
Message type: classic | ||
Timestamp format: %Y-%m-%dT%H:%M:%S.000 | ||
Placement: none | ||
Compression codec: zstd | ||
GCS 2/2 | ||
User: 123456 | ||
URL: https://test123.grafana.net | ||
Token: testtoken | ||
Index: {"label": "value"} | ||
GrafanaCloudLogs 2/2 | ||
Service ID: 123 | ||
Version: 1 | ||
Name: analytics | ||
Bucket: analytics | ||
User: [email protected] | ||
Account name: [email protected] | ||
Secret key: -----BEGIN RSA PRIVATE KEY-----foo | ||
Path: logs/ | ||
Period: 86400 | ||
GZip level: 0 | ||
Format: %h %l %u %t "%r" %>s %b | ||
Format version: 2 | ||
Response condition: Prevent default logging | ||
Message type: classic | ||
Timestamp format: %Y-%m-%dT%H:%M:%S.000 | ||
Placement: none | ||
Compression codec: zstd | ||
User: 123456 | ||
URL: https://test123.grafana.net | ||
Token: testtoken | ||
Index: {"label": "value"} | ||
`) + "\n\n" | ||
|
||
func getGrafanaCloudLogsOK(i *fastly.GetGrafanaCloudLogsInput) (*fastly.GrafanaCloudLogs, error) { | ||
|
@@ -380,7 +370,11 @@ func getGrafanaCloudLogsOK(i *fastly.GetGrafanaCloudLogsInput) (*fastly.GrafanaC | |
FormatVersion: fastly.ToPointer(2), | ||
MessageType: fastly.ToPointer("classic"), | ||
ResponseCondition: fastly.ToPointer("Prevent default logging"), | ||
Placement: fastly.ToPointer("zstd"), | ||
Placement: fastly.ToPointer("none"), | ||
User: fastly.ToPointer("123456"), | ||
Token: fastly.ToPointer("testtoken"), | ||
URL: fastly.ToPointer("https://test123.grafana.net"), | ||
Index: fastly.ToPointer("{\"label\": \"value\"}"), | ||
}, nil | ||
} | ||
|
||
|
@@ -391,10 +385,15 @@ func getGrafanaCloudLogsError(_ *fastly.GetGrafanaCloudLogsInput) (*fastly.Grafa | |
var describeGrafanaCloudLogsOutput = "\n" + strings.TrimSpace(` | ||
Format: %h %l %u %t "%r" %>s %b | ||
Format version: 2 | ||
Index: {"label": "value"} | ||
Message type: classic | ||
Name: logs | ||
Placement: none | ||
Response condition: Prevent default logging | ||
Service ID: 123 | ||
Token: testtoken | ||
URL: https://test123.grafana.net | ||
User: 123456 | ||
Version: 1 | ||
`) + "\n" | ||
|
||
|
@@ -403,12 +402,15 @@ func updateGrafanaCloudLogsOK(i *fastly.UpdateGrafanaCloudLogsInput) (*fastly.Gr | |
ServiceID: fastly.ToPointer(i.ServiceID), | ||
ServiceVersion: fastly.ToPointer(i.ServiceVersion), | ||
Name: fastly.ToPointer("log"), | ||
User: fastly.ToPointer("[email protected]"), | ||
Format: fastly.ToPointer(`%h %l %u %t "%r" %>s %b`), | ||
FormatVersion: fastly.ToPointer(2), | ||
ResponseCondition: fastly.ToPointer("Prevent default logging"), | ||
MessageType: fastly.ToPointer("classic"), | ||
Placement: fastly.ToPointer("none"), | ||
User: fastly.ToPointer("123456"), | ||
Token: fastly.ToPointer("testtoken"), | ||
URL: fastly.ToPointer("https://test123.grafana.net"), | ||
Index: fastly.ToPointer("{\"label\": \"value\"}"), | ||
}, nil | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters