event: Enhance event message struct to provide origin server. (#3557)

`principalId` i.e user identity is kept as AccessKey in
accordance with S3 spec.

Additionally responseElements{} are added starting with

`x-amz-request-id` is a hexadecimal of the event time itself in nanosecs.
`x-minio-origin-server` - points to the server generating the event.

Fixes #3556
This commit is contained in:
Harshavardhana
2017-01-10 16:43:48 -08:00
committed by GitHub
parent 0563a9235a
commit b0cfceb211
20 changed files with 309 additions and 161 deletions

View File

@@ -94,3 +94,39 @@ func TestCertificateNotExpired(t *testing.T) {
t.Fatalf("Expected empty message was: %s", msg)
}
}
// Test printing server common message.
func TestPrintServerCommonMessage(t *testing.T) {
root, err := newTestConfig("us-east-1")
if err != nil {
t.Fatal(err)
}
defer removeAll(root)
apiEndpoints := []string{"127.0.0.1:9000"}
printServerCommonMsg(apiEndpoints)
}
// Tests print cli access message.
func TestPrintCLIAccessMsg(t *testing.T) {
root, err := newTestConfig("us-east-1")
if err != nil {
t.Fatal(err)
}
defer removeAll(root)
apiEndpoints := []string{"127.0.0.1:9000"}
printCLIAccessMsg(apiEndpoints[0])
}
// Test print startup message.
func TestPrintStartupMessage(t *testing.T) {
root, err := newTestConfig("us-east-1")
if err != nil {
t.Fatal(err)
}
defer removeAll(root)
apiEndpoints := []string{"127.0.0.1:9000"}
printStartupMessage(apiEndpoints)
}