Loading .gitignore +1 −0 Changes for .gitignore: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ CLAUDE.md .claude/ bin/ coverage.out todo.md ops/registryHandler.go +8 −6 Changes for ops/registryHandler.go: 8 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -102,12 +102,13 @@ func extractMetadata(msg []byte) (msgType, processID, serviceID string, err erro } msgType = temp.Data.Type processID = temp.ProcessID if temp.Data.ServiceOrderRequest.ServiceOrder.ServiceID != "" { serviceID = temp.Data.ServiceOrderRequest.ServiceOrder.ServiceID } else if temp.Data.ServiceOperationReq.ServiceID != "" { if orderReq := temp.Data.ServiceOrderRequest; orderReq.ServiceOrder.ServiceID != "" { serviceID = orderReq.ServiceOrder.ServiceID processID = orderReq.ProcessID } else { serviceID = temp.Data.ServiceOperationReq.ServiceID processID = temp.Data.ServiceOperationReq.ProcessID } return msgType, processID, serviceID, nil Loading @@ -134,16 +135,17 @@ func (op *Operator) logAndHandleRegistryError(traceCtx context.Context, ctx goka } type RegistryMetadata struct { ProcessID string `json:"kogitoprocinstanceid"` Data struct { Type string `json:"type"` ServiceOrderRequest struct { ProcessID string `json:"kogitoprocinstanceid"` ServiceOrder struct { ServiceID string `json:"serviceId"` } `json:"serviceOrder"` } `json:"serviceOrderRequest"` ServiceOperationReq struct { ProcessID string `json:"kogitoprocinstanceid"` ServiceID string `json:"serviceId"` } `json:"serviceOperationReq"` } `json:"serviceOperationRequest"` } `json:"data"` } ops/registryHandler_test.go +60 −10 Changes for ops/registryHandler_test.go: 60 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -14,12 +14,14 @@ func TestExtractMetadata(t *testing.T) { wantErr bool }{ { name: "Valid Parsing Payload (Nested in ServiceOrder)", name: "Parsing reply (IDs nested in serviceOrderRequest)", payload: `{ "kogitoprocinstanceid": "proc-123", "id": "srv-abc", "status": "SUCCESS", "data": { "type": "parsing", "serviceOrderRequest": { "kogitoprocinstanceid": "proc-123", "serviceOrder": { "serviceId": "srv-abc" } Loading @@ -29,23 +31,72 @@ func TestExtractMetadata(t *testing.T) { wantType: "parsing", wantProcessID: "proc-123", wantServiceID: "srv-abc", wantErr: false, }, { name: "Valid Deployment Payload (Nested in ServiceOperationReq)", name: "Deployment reply (IDs nested in serviceOperationRequest)", payload: `{ "kogitoprocinstanceid": "proc-999", "id": "srv-xyz", "status": "SUCCESS", "data": { "type": "deployment", "serviceOperationReq": { "serviceOperationRequest": { "kogitoprocinstanceid": "proc-999", "serviceId": "srv-xyz" } }, "kubeConfigAsBase64": "a3ViZWNvbmZpZw==" } }`, wantType: "deployment", wantProcessID: "proc-999", wantServiceID: "srv-xyz", wantErr: false, }, { name: "Activation reply", payload: `{ "data": { "type": "activation", "serviceOperationRequest": { "kogitoprocinstanceid": "proc-act", "serviceId": "srv-act" } } }`, wantType: "activation", wantProcessID: "proc-act", wantServiceID: "srv-act", }, { name: "Termination failure reply still carries the echoed IDs", payload: `{ "id": "srv-term", "status": "FAILURE", "message": "No Authorization header found", "data": { "type": "termination", "serviceOperationRequest": { "kogitoprocinstanceid": "proc-term", "serviceId": "srv-term" } } }`, wantType: "termination", wantProcessID: "proc-term", wantServiceID: "srv-term", }, { name: "Top-level kogitoprocinstanceid and serviceOperationReq are not the wire format", payload: `{ "kogitoprocinstanceid": "proc-wrong", "data": { "type": "deployment", "serviceOperationReq": { "serviceId": "srv-wrong" } } }`, wantType: "deployment", wantProcessID: "", wantServiceID: "", }, { name: "Missing IDs (Should not panic, just return empty strings)", Loading @@ -57,11 +108,10 @@ func TestExtractMetadata(t *testing.T) { wantType: "activation", wantProcessID: "", wantServiceID: "", wantErr: false, }, { name: "Completely Malformed JSON", payload: `{"kogitoprocinstanceid": oops broken json}`, payload: `{"data": oops broken json}`, wantErr: true, }, } Loading Loading
.gitignore +1 −0 Changes for .gitignore: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ CLAUDE.md .claude/ bin/ coverage.out todo.md
ops/registryHandler.go +8 −6 Changes for ops/registryHandler.go: 8 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -102,12 +102,13 @@ func extractMetadata(msg []byte) (msgType, processID, serviceID string, err erro } msgType = temp.Data.Type processID = temp.ProcessID if temp.Data.ServiceOrderRequest.ServiceOrder.ServiceID != "" { serviceID = temp.Data.ServiceOrderRequest.ServiceOrder.ServiceID } else if temp.Data.ServiceOperationReq.ServiceID != "" { if orderReq := temp.Data.ServiceOrderRequest; orderReq.ServiceOrder.ServiceID != "" { serviceID = orderReq.ServiceOrder.ServiceID processID = orderReq.ProcessID } else { serviceID = temp.Data.ServiceOperationReq.ServiceID processID = temp.Data.ServiceOperationReq.ProcessID } return msgType, processID, serviceID, nil Loading @@ -134,16 +135,17 @@ func (op *Operator) logAndHandleRegistryError(traceCtx context.Context, ctx goka } type RegistryMetadata struct { ProcessID string `json:"kogitoprocinstanceid"` Data struct { Type string `json:"type"` ServiceOrderRequest struct { ProcessID string `json:"kogitoprocinstanceid"` ServiceOrder struct { ServiceID string `json:"serviceId"` } `json:"serviceOrder"` } `json:"serviceOrderRequest"` ServiceOperationReq struct { ProcessID string `json:"kogitoprocinstanceid"` ServiceID string `json:"serviceId"` } `json:"serviceOperationReq"` } `json:"serviceOperationRequest"` } `json:"data"` }
ops/registryHandler_test.go +60 −10 Changes for ops/registryHandler_test.go: 60 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -14,12 +14,14 @@ func TestExtractMetadata(t *testing.T) { wantErr bool }{ { name: "Valid Parsing Payload (Nested in ServiceOrder)", name: "Parsing reply (IDs nested in serviceOrderRequest)", payload: `{ "kogitoprocinstanceid": "proc-123", "id": "srv-abc", "status": "SUCCESS", "data": { "type": "parsing", "serviceOrderRequest": { "kogitoprocinstanceid": "proc-123", "serviceOrder": { "serviceId": "srv-abc" } Loading @@ -29,23 +31,72 @@ func TestExtractMetadata(t *testing.T) { wantType: "parsing", wantProcessID: "proc-123", wantServiceID: "srv-abc", wantErr: false, }, { name: "Valid Deployment Payload (Nested in ServiceOperationReq)", name: "Deployment reply (IDs nested in serviceOperationRequest)", payload: `{ "kogitoprocinstanceid": "proc-999", "id": "srv-xyz", "status": "SUCCESS", "data": { "type": "deployment", "serviceOperationReq": { "serviceOperationRequest": { "kogitoprocinstanceid": "proc-999", "serviceId": "srv-xyz" } }, "kubeConfigAsBase64": "a3ViZWNvbmZpZw==" } }`, wantType: "deployment", wantProcessID: "proc-999", wantServiceID: "srv-xyz", wantErr: false, }, { name: "Activation reply", payload: `{ "data": { "type": "activation", "serviceOperationRequest": { "kogitoprocinstanceid": "proc-act", "serviceId": "srv-act" } } }`, wantType: "activation", wantProcessID: "proc-act", wantServiceID: "srv-act", }, { name: "Termination failure reply still carries the echoed IDs", payload: `{ "id": "srv-term", "status": "FAILURE", "message": "No Authorization header found", "data": { "type": "termination", "serviceOperationRequest": { "kogitoprocinstanceid": "proc-term", "serviceId": "srv-term" } } }`, wantType: "termination", wantProcessID: "proc-term", wantServiceID: "srv-term", }, { name: "Top-level kogitoprocinstanceid and serviceOperationReq are not the wire format", payload: `{ "kogitoprocinstanceid": "proc-wrong", "data": { "type": "deployment", "serviceOperationReq": { "serviceId": "srv-wrong" } } }`, wantType: "deployment", wantProcessID: "", wantServiceID: "", }, { name: "Missing IDs (Should not panic, just return empty strings)", Loading @@ -57,11 +108,10 @@ func TestExtractMetadata(t *testing.T) { wantType: "activation", wantProcessID: "", wantServiceID: "", wantErr: false, }, { name: "Completely Malformed JSON", payload: `{"kogitoprocinstanceid": oops broken json}`, payload: `{"data": oops broken json}`, wantErr: true, }, } Loading