Repository: clouditor/clouditor
Pull request #1129 (2023-06-06 18:29:33)

Add tool_id to assessment_result and filter by tool_id Part 2
I'm sorry, my 'git push' was not successfull. Please, could someone approve this PR again?


Patch:
diff --git a/api/assessment/assessment.pb.go b/api/assessment/assessment.pb.go
index ebe463d4..a2b0362b 100644
--- a/api/assessment/assessment.pb.go
+++ b/api/assessment/assessment.pb.go
@@ -402,7 +402,7 @@ type AssessmentResult struct {
 	// The cloud service which this assessment result belongs to
 	CloudServiceId string `protobuf:"bytes,10,opt,name=cloud_service_id,json=cloudServiceId,proto3" json:"cloud_service_id,omitempty"`
 	// Reference to the tool which provided the assessment result
-	ToolId string `protobuf:"bytes,11,opt,name=tool_id,json=toolId,proto3" json:"tool_id,omitempty"`
+	ToolId *string `protobuf:"bytes,11,opt,name=tool_id,json=toolId,proto3,oneof" json:"tool_id,omitempty"`
 }
 
 func (x *AssessmentResult) Reset() {
@@ -508,8 +508,8 @@ func (x *AssessmentResult) GetCloudServiceId() string {
 }
 
 func (x *AssessmentResult) GetToolId() string {
-	if x != nil {
-		return x.ToolId
+	if x != nil && x.ToolId != nil {
+		return *x.ToolId
 	}
 	return ""
 }
@@ -564,7 +564,7 @@ var file_api_assessment_assessment_proto_rawDesc = []byte{
 	0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x57, 0x41, 0x49, 0x54, 0x49,
 	0x4e, 0x47, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01,
 	0x12, 0x0c, 0x0a, 0x08, 0x41, 0x53, 0x53, 0x45, 0x53, 0x53, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0a,
-	0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x22, 0x96, 0x05, 0x0a, 0x10, 0x41,
+	0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x22, 0xa7, 0x05, 0x0a, 0x10, 0x41,
 	0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12,
 	0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05,
 	0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x6e, 0x0a, 0x09, 0x74, 0x69, 0x6d,
@@ -604,37 +604,38 @@ var file_api_assessment_assessment_proto_rawDesc = []byte{
 	0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69,
 	0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, 0x03, 0xb0, 0x01,
 	0x01, 0x52, 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49,
-	0x64, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01,
-	0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x6f, 0x6f,
-	0x6c, 0x49, 0x64, 0x32, 0x8d, 0x03, 0x0a, 0x0a, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65,
-	0x6e, 0x74, 0x12, 0x64, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x43,
-	0x6f, 0x6d, 0x70, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x33, 0x2e, 0x63, 0x6c, 0x6f, 0x75,
-	0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65, 0x6e, 0x74,
-	0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d,
-	0x70, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
-	0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
-	0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x9d, 0x01, 0x0a, 0x0e, 0x41, 0x73, 0x73,
-	0x65, 0x73, 0x73, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x2e, 0x63, 0x6c,
-	0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65,
-	0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69, 0x64,
-	0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63, 0x6c,
-	0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65,
-	0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69, 0x64,
-	0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3,
-	0xe4, 0x93, 0x02, 0x24, 0x3a, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x18,
-	0x2f, 0x76, 0x31, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65,
-	0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x79, 0x0a, 0x0f, 0x41, 0x73, 0x73, 0x65,
-	0x73, 0x73, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2e, 0x2e, 0x63, 0x6c,
-	0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65,
-	0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69, 0x64,
-	0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6c,
-	0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65,
-	0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69, 0x64,
-	0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28,
-	0x01, 0x30, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72,
-	0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2f, 0x61, 0x70,
-	0x69, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x33,
+	0x64, 0x12, 0x25, 0x0a, 0x07, 0x74, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01,
+	0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x06, 0x74,
+	0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x74, 0x6f, 0x6f,
+	0x6c, 0x5f, 0x69, 0x64, 0x32, 0x8d, 0x03, 0x0a, 0x0a, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d,
+	0x65, 0x6e, 0x74, 0x12, 0x64, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65,
+	0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x33, 0x2e, 0x63, 0x6c, 0x6f,
+	0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65, 0x6e,
+	0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x6f,
+	0x6d, 0x70, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+	0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+	0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x9d, 0x01, 0x0a, 0x0e, 0x41, 0x73,
+	0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x2e, 0x63,
+	0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d,
+	0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69,
+	0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63,
+	0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d,
+	0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69,
+	0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82,
+	0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22,
+	0x18, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65, 0x6e, 0x74, 0x2f,
+	0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x79, 0x0a, 0x0f, 0x41, 0x73, 0x73,
+	0x65, 0x73, 0x73, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2e, 0x2e, 0x63,
+	0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d,
+	0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69,
+	0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63,
+	0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d,
+	0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x73, 0x73, 0x45, 0x76, 0x69,
+	0x64, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
+	0x28, 0x01, 0x30, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f,
+	0x72, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2f, 0x61,
+	0x70, 0x69, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x73, 0x73, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70,
+	0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -775,6 +776,7 @@ func file_api_assessment_assessment_proto_init() {
 			}
 		}
 	}
+	file_api_assessment_assessment_proto_msgTypes[6].OneofWrappers = []interface{}{}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
 		File: protoimpl.DescBuilder{
diff --git a/api/assessment/assessment.pb.validate.go b/api/assessment/assessment.pb.validate.go
index 6b7b4618..f277bd38 100644
--- a/api/assessment/assessment.pb.validate.go
+++ b/api/assessment/assessment.pb.validate.go
@@ -843,15 +843,19 @@ func (m *AssessmentResult) validate(all bool) error {
 		errors = append(errors, err)
 	}
 
-	if utf8.RuneCountInString(m.GetToolId()) < 1 {
-		err := AssessmentResultValidationError{
-			field:  "ToolId",
-			reason: "value length must be at least 1 runes",
-		}
-		if !all {
-			return err
+	if m.ToolId != nil {
+
+		if utf8.RuneCountInString(m.GetToolId()) < 1 {
+			err := AssessmentResultValidationError{
+				field:  "ToolId",
+				reason: "value length must be at least 1 runes",
+			}
+			if !all {
+				return err
+			}
+			errors = append(errors, err)
 		}
-		errors = append(errors, err)
+
 	}
 
 	if len(errors) > 0 {
diff --git a/api/assessment/assessment.proto b/api/assessment/assessment.proto
index b3e641ab..7bef9c98 100644
--- a/api/assessment/assessment.proto
+++ b/api/assessment/assessment.proto
@@ -136,7 +136,7 @@ message AssessmentResult {
   string cloud_service_id = 10 [ (validate.rules).string.uuid = true ];
 
   // Reference to the tool which provided the assessment result
-  string tool_id = 11 [ (validate.rules).string.min_len = 1 ];
+  optional string tool_id = 11 [ (validate.rules).string.min_len = 1 ];
 }
 
 /*
diff --git a/service/assessment/assessment.go b/service/assessment/assessment.go
index 842c8a2d..fc40c210 100644
--- a/service/assessment/assessment.go
+++ b/service/assessment/assessment.go
@@ -38,6 +38,7 @@ import (
 	"clouditor.io/clouditor/api/evidence"
 	"clouditor.io/clouditor/api/orchestrator"
 	"clouditor.io/clouditor/internal/logging"
+	"clouditor.io/clouditor/internal/util"
 	"clouditor.io/clouditor/policies"
 	"clouditor.io/clouditor/service"
 
@@ -355,7 +356,7 @@ func (svc *Service) handleEvidence(ev *evidence.Evidence, resourceId string) (re
 			ResourceId:            resourceId,
 			ResourceTypes:         types,
 			NonComplianceComments: "No comments so far",
-			ToolId:                assessment.AssessmentToolId,
+			ToolId:                util.Ref(assessment.AssessmentToolId),
 		}
 
 		// Inform hooks about new assessment result


Test patch:
diff --git a/api/assessment/assessment_test.go b/api/assessment/assessment_test.go
index 5b9daa2c..7288681c 100644
--- a/api/assessment/assessment_test.go
+++ b/api/assessment/assessment_test.go
@@ -29,6 +29,7 @@ import (
 	"testing"
 
 	"clouditor.io/clouditor/internal/testdata"
+	"clouditor.io/clouditor/internal/util"
 	"github.com/stretchr/testify/assert"
 	"google.golang.org/protobuf/types/known/timestamppb"
 )
@@ -256,7 +257,7 @@ func Test_ValidateAssessmentResult(t *testing.T) {
 					ResourceId:     "myResource",
 					ResourceTypes:  []string{"Resource"},
 					CloudServiceId: testdata.MockCloudServiceID1,
-					ToolId:         AssessmentToolId,
+					ToolId:         util.Ref(AssessmentToolId),
 				},
 			},
 			wantResp: "",
diff --git a/cli/commands/assessmentresult/assessment_result_test.go b/cli/commands/assessmentresult/assessment_result_test.go
index 4ec1a613..3b6de06c 100644
--- a/cli/commands/assessmentresult/assessment_result_test.go
+++ b/cli/commands/assessmentresult/assessment_result_test.go
@@ -37,6 +37,7 @@ import (
 	"clouditor.io/clouditor/cli"
 	"clouditor.io/clouditor/internal/testdata"
 	"clouditor.io/clouditor/internal/testutil/clitest"
+	"clouditor.io/clouditor/internal/util"
 	"clouditor.io/clouditor/server"
 	service_orchestrator "clouditor.io/clouditor/service/orchestrator"
 
@@ -73,7 +74,7 @@ func TestMain(m *testing.M) {
 				IsDefault:      true,
 				CloudServiceId: testdata.MockCloudServiceID1,
 			},
-			ToolId: assessment.AssessmentToolId,
+			ToolId: util.Ref(assessment.AssessmentToolId),
 		}})
 	if err != nil {
 		panic(err)
diff --git a/cli/commands/service/orchestrator/orchestrator_test.go b/cli/commands/service/orchestrator/orchestrator_test.go
index 8788f907..d646ad6f 100644
--- a/cli/commands/service/orchestrator/orchestrator_test.go
+++ b/cli/commands/service/orchestrator/orchestrator_test.go
@@ -35,6 +35,7 @@ import (
 	"clouditor.io/clouditor/internal/testdata"
 	"clouditor.io/clouditor/internal/testutil/clitest"
 	"clouditor.io/clouditor/internal/testutil/servicetest/orchestratortest"
+	"clouditor.io/clouditor/internal/util"
 	"clouditor.io/clouditor/server"
 
 	"clouditor.io/clouditor/api/assessment"
@@ -75,7 +76,7 @@ func TestMain(m *testing.M) {
 				MetricId:       testdata.MockMetricID1,
 				CloudServiceId: testdata.MockCloudServiceID1,
 			},
-			ToolId: assessment.AssessmentToolId,
+			ToolId: util.Ref(assessment.AssessmentToolId),
 		}})
 	if err != nil {
 		panic(err)
diff --git a/internal/testutil/servicetest/orchestratortest/orchestrator.go b/internal/testutil/servicetest/orchestratortest/orchestrator.go
index 366332eb..e5b8914a 100644
--- a/internal/testutil/servicetest/orchestratortest/orchestrator.go
+++ b/internal/testutil/servicetest/orchestratortest/orchestrator.go
@@ -149,7 +149,7 @@ var (
 			MetricId:       testdata.MockMetricID1,
 			CloudServiceId: testdata.MockCloudServiceID1,
 		},
-		ToolId: assessment.AssessmentToolId,
+		ToolId: util.Ref(assessment.AssessmentToolId),
 	}
 	MockAssessmentResult2 = &assessment.AssessmentResult{
 		Id:             testdata.MockAssessmentResult2ID,
@@ -167,7 +167,7 @@ var (
 			MetricId:       testdata.MockMetricID1,
 			CloudServiceId: testdata.MockCloudServiceID2,
 		},
-		ToolId: assessment.AssessmentToolId,
+		ToolId: util.Ref(assessment.AssessmentToolId),
 	}
 	MockAssessmentResult3 = &assessment.AssessmentResult{
 		Id:             testdata.MockAssessmentResult3ID,
@@ -185,7 +185,7 @@ var (
 			MetricId:       testdata.MockMetricID2,
 			CloudServiceId: testdata.MockCloudServiceID1,
 		},
-		ToolId: assessment.AssessmentToolId,
+		ToolId: util.Ref(assessment.AssessmentToolId),
 	}
 	MockAssessmentResult4 = &assessment.AssessmentResult{
 		Id:             testdata.MockAssessmentResult4ID,
@@ -203,7 +203,7 @@ var (
 			MetricId:       testdata.MockMetricID2,
 			CloudServiceId: testdata.MockCloudServiceID2,
 		},
-		ToolId: testdata.MockAssessmentResultToolID,
+		ToolId: util.Ref(testdata.MockAssessmentResultToolID),
 	}
 	MockAssessmentResults = []*assessment.AssessmentResult{MockAssessmentResult1, MockAssessmentResult2, MockAssessmentResult3, MockAssessmentResult4}
 
diff --git a/service/orchestrator/assessment_results_test.go b/service/orchestrator/assessment_results_test.go
index 233d698e..db18a882 100644
--- a/service/orchestrator/assessment_results_test.go
+++ b/service/orchestrator/assessment_results_test.go
@@ -661,7 +661,7 @@ func TestAssessmentResultHook(t *testing.T) {
 						Compliant:             true,
 						ResourceId:            testdata.MockResourceID1,
 						ResourceTypes:         []string{"ResourceType"},
-						ToolId:                assessment.AssessmentToolId,
+						ToolId:                util.Ref(assessment.AssessmentToolId),
 					},
 				},
 			},
@@ -729,7 +729,7 @@ func TestStoreAssessmentResult(t *testing.T) {
 						Compliant:             true,
 						ResourceId:            testdata.MockResourceID1,
 						ResourceTypes:         []string{"ResourceType"},
-						ToolId:                assessment.AssessmentToolId,
+						ToolId:                util.Ref(assessment.AssessmentToolId),
 					},
 				},
 			},
@@ -757,7 +757,7 @@ func TestStoreAssessmentResult(t *testing.T) {
 						Compliant:             true,
 						ResourceId:            testdata.MockResourceID1,
 						ResourceTypes:         []string{"ResourceType"},
-						ToolId:                assessment.AssessmentToolId,
+						ToolId:                util.Ref(assessment.AssessmentToolId),
 					},
 				},
 			},
@@ -940,7 +940,7 @@ func createStoreAssessmentResultRequestsMock(count int) []*orchestrator.StoreAss
 				Compliant:             true,
 				ResourceId:            testdata.MockResourceID1,
 				ResourceTypes:         []string{"ResourceType"},
-				ToolId:                assessment.AssessmentToolId,
+				ToolId:                util.Ref(assessment.AssessmentToolId),
 			},
 		}