Separate request data from actor in Event

To clarify the role of actor, the request data that initiates an event has been
separated. The ActorRecord is pared down to just the username. This eliminates
confusion about where event related data should be added.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2015-02-03 13:28:10 -08:00
parent 0a29b59e14
commit 080e329cb1
4 changed files with 79 additions and 38 deletions

View file

@ -25,11 +25,15 @@ func TestEventEnvelopeJSONFormat(t *testing.T) {
"tag": "latest",
"url": "http://example.com/v2/library/test/manifests/latest"
},
"actor": {
"name": "test-actor",
"request": {
"id": "asdfasdf",
"addr": "client.local",
"host": "registrycluster.local",
"requestID": "asdfasdf"
"method": "PUT",
"useragent": "test/0.1"
},
"actor": {
"name": "test-actor"
},
"source": {
"addr": "hostname.local:port"
@ -45,11 +49,15 @@ func TestEventEnvelopeJSONFormat(t *testing.T) {
"digest": "tarsum.v2+sha256:0123456789abcdef1",
"url": "http://example.com/v2/library/test/manifests/latest"
},
"actor": {
"name": "test-actor",
"request": {
"id": "asdfasdf",
"addr": "client.local",
"host": "registrycluster.local",
"requestID": "asdfasdf"
"method": "PUT",
"useragent": "test/0.1"
},
"actor": {
"name": "test-actor"
},
"source": {
"addr": "hostname.local:port"
@ -65,11 +73,15 @@ func TestEventEnvelopeJSONFormat(t *testing.T) {
"digest": "tarsum.v2+sha256:0123456789abcdef2",
"url": "http://example.com/v2/library/test/manifests/latest"
},
"actor": {
"name": "test-actor",
"request": {
"id": "asdfasdf",
"addr": "client.local",
"host": "registrycluster.local",
"requestID": "asdfasdf"
"method": "PUT",
"useragent": "test/0.1"
},
"actor": {
"name": "test-actor"
},
"source": {
"addr": "hostname.local:port"
@ -87,10 +99,12 @@ func TestEventEnvelopeJSONFormat(t *testing.T) {
var prototype Event
prototype.Action = "push"
prototype.Timestamp = tm
prototype.Actor.Addr = "client.local"
prototype.Actor.Name = "test-actor"
prototype.Actor.RequestID = "asdfasdf"
prototype.Actor.Host = "registrycluster.local"
prototype.Request.ID = "asdfasdf"
prototype.Request.Addr = "client.local"
prototype.Request.Host = "registrycluster.local"
prototype.Request.Method = "PUT"
prototype.Request.UserAgent = "test/0.1"
prototype.Source.Addr = "hostname.local:port"
var manifestPush Event