Repository: clouditor/clouditor
Pull request #1166 (2023-07-13 07:57:38)

Fixes for MEDINA

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/clouditor/clouditor/pull/1166?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) Report
> Merging [#1166](https://app.codecov.io/gh/clouditor/clouditor/pull/1166?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) (717bfd5) into [main](https://app.codecov.io/gh/clouditor/clouditor/commit/6604fb34f6dfb02ff0589f6a9129ccd6b2344bbb?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) (6604fb3) will **decrease** coverage by `0.07%`.
> The diff coverage is `35.71%`.

```diff
@@            Coverage Diff             @@
##             main    #1166      +/-   ##
==========================================
- Coverage   84.02%   83.95%   -0.07%     
==========================================
  Files          94       94              
  Lines        8981     8983       +2     
==========================================
- Hits         7546     7542       -4     
- Misses       1101     1106       +5     
- Partials      334      335       +1     
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `83.95% <35.71%> (-0.07%)` | :arrow_down: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://app.codecov.io/gh/clouditor/clouditor/pull/1166?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) | Coverage Δ | |
|---|---|---|
| [policies/rego.go](https://app.codecov.io/gh/clouditor/clouditor/pull/1166?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-cG9saWNpZXMvcmVnby5nbw==) | `68.92% <0.00%> (-0.56%)` | :arrow_down: |
| [service/orchestrator/orchestrator.go](https://app.codecov.io/gh/clouditor/clouditor/pull/1166?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9vcmNoZXN0cmF0b3Ivb3JjaGVzdHJhdG9yLmdv) | `79.72% <ø> (ø)` | |
| [service/discovery/azure/compute.go](https://app.codecov.io/gh/clouditor/clouditor/pull/1166?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvYXp1cmUvY29tcHV0ZS5nbw==) | `82.83% <14.28%> (ø)` | |
| [service/orchestrator/assessment\_results.go](https://app.codecov.io/gh/clouditor/clouditor/pull/1166?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9vcmNoZXN0cmF0b3IvYXNzZXNzbWVudF9yZXN1bHRzLmdv) | `91.62% <100.00%> (ø)` | |

... and [1 file with indirect coverage changes](https://app.codecov.io/gh/clouditor/clouditor/pull/1166/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor)



Patch:
diff --git a/api/orchestrator/orchestrator.pb.go b/api/orchestrator/orchestrator.pb.go
index b29da439..4ddf3715 100644
--- a/api/orchestrator/orchestrator.pb.go
+++ b/api/orchestrator/orchestrator.pb.go
@@ -6029,8 +6029,8 @@ var file_api_orchestrator_orchestrator_proto_rawDesc = []byte{
 	0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
 	0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93,
 	0x02, 0x26, 0x12, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72,
-	0x61, 0x74, 0x6f, 0x72, 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65,
-	0x73, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0xb5, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64,
+	0x61, 0x74, 0x6f, 0x72, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x63, 0x65, 0x72, 0x74,
+	0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x12, 0xb5, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64,
 	0x61, 0x74, 0x65, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x33,
 	0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65,
 	0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
diff --git a/api/orchestrator/orchestrator.pb.gw.go b/api/orchestrator/orchestrator.pb.gw.go
index 05ad7375..47ecfd7c 100644
--- a/api/orchestrator/orchestrator.pb.gw.go
+++ b/api/orchestrator/orchestrator.pb.gw.go
@@ -3521,7 +3521,7 @@ func RegisterOrchestratorHandlerServer(ctx context.Context, mux *runtime.ServeMu
 		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
 		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
 		var err error
-		ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/clouditor.orchestrator.v1.Orchestrator/ListPublicCertificates", runtime.WithHTTPPathPattern("/v1/orchestrator/certificates/public"))
+		ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/clouditor.orchestrator.v1.Orchestrator/ListPublicCertificates", runtime.WithHTTPPathPattern("/v1/orchestrator/public/certificates"))
 		if err != nil {
 			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
 			return
@@ -4682,7 +4682,7 @@ func RegisterOrchestratorHandlerClient(ctx context.Context, mux *runtime.ServeMu
 		defer cancel()
 		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
 		var err error
-		ctx, err = runtime.AnnotateContext(ctx, mux, req, "/clouditor.orchestrator.v1.Orchestrator/ListPublicCertificates", runtime.WithHTTPPathPattern("/v1/orchestrator/certificates/public"))
+		ctx, err = runtime.AnnotateContext(ctx, mux, req, "/clouditor.orchestrator.v1.Orchestrator/ListPublicCertificates", runtime.WithHTTPPathPattern("/v1/orchestrator/public/certificates"))
 		if err != nil {
 			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
 			return
@@ -5237,7 +5237,7 @@ var (
 
 	pattern_Orchestrator_ListCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "orchestrator", "certificates"}, ""))
 
-	pattern_Orchestrator_ListPublicCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "orchestrator", "certificates", "public"}, ""))
+	pattern_Orchestrator_ListPublicCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "orchestrator", "public", "certificates"}, ""))
 
 	pattern_Orchestrator_UpdateCertificate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "orchestrator", "certificates", "certificate.id"}, ""))
 
diff --git a/api/orchestrator/orchestrator.proto b/api/orchestrator/orchestrator.proto
index 95e40386..a03a9c33 100644
--- a/api/orchestrator/orchestrator.proto
+++ b/api/orchestrator/orchestrator.proto
@@ -274,7 +274,7 @@ service Orchestrator {
   rpc ListPublicCertificates(ListPublicCertificatesRequest)
       returns (ListPublicCertificatesResponse) {
     option (google.api.http) = {
-      get : "/v1/orchestrator/certificates/public"
+      get : "/v1/orchestrator/public/certificates"
     };
   }
 
diff --git a/openapi/orchestrator/openapi.yaml b/openapi/orchestrator/openapi.yaml
index 1c1e35e8..e3a12006 100644
--- a/openapi/orchestrator/openapi.yaml
+++ b/openapi/orchestrator/openapi.yaml
@@ -567,43 +567,6 @@ paths:
                         application/json:
                             schema:
                                 $ref: '#/components/schemas/Status'
-    /v1/orchestrator/certificates/public:
-        get:
-            tags:
-                - Orchestrator
-            description: Lists all target certificates without state history
-            operationId: Orchestrator_ListPublicCertificates
-            parameters:
-                - name: pageSize
-                  in: query
-                  schema:
-                    type: integer
-                    format: int32
-                - name: pageToken
-                  in: query
-                  schema:
-                    type: string
-                - name: orderBy
-                  in: query
-                  schema:
-                    type: string
-                - name: asc
-                  in: query
-                  schema:
-                    type: boolean
-            responses:
-                "200":
-                    description: OK
-                    content:
-                        application/json:
-                            schema:
-                                $ref: '#/components/schemas/ListPublicCertificatesResponse'
-                default:
-                    description: Default error response
-                    content:
-                        application/json:
-                            schema:
-                                $ref: '#/components/schemas/Status'
     /v1/orchestrator/certificates/{certificate.id}:
         put:
             tags:
@@ -1419,6 +1382,43 @@ paths:
                         application/json:
                             schema:
                                 $ref: '#/components/schemas/Status'
+    /v1/orchestrator/public/certificates:
+        get:
+            tags:
+                - Orchestrator
+            description: Lists all target certificates without state history
+            operationId: Orchestrator_ListPublicCertificates
+            parameters:
+                - name: pageSize
+                  in: query
+                  schema:
+                    type: integer
+                    format: int32
+                - name: pageToken
+                  in: query
+                  schema:
+                    type: string
+                - name: orderBy
+                  in: query
+                  schema:
+                    type: string
+                - name: asc
+                  in: query
+                  schema:
+                    type: boolean
+            responses:
+                "200":
+                    description: OK
+                    content:
+                        application/json:
+                            schema:
+                                $ref: '#/components/schemas/ListPublicCertificatesResponse'
+                default:
+                    description: Default error response
+                    content:
+                        application/json:
+                            schema:
+                                $ref: '#/components/schemas/Status'
     /v1/orchestrator/runtime_info:
         get:
             tags:
diff --git a/policies/rego.go b/policies/rego.go
index dd84f3f4..9c96fa57 100644
--- a/policies/rego.go
+++ b/policies/rego.go
@@ -135,7 +135,9 @@ func (re *regoEval) Eval(evidence *evidence.Evidence, src MetricsSource) (data [
 			if err != nil {
 				// Try to retrieve the gRPC status from the error, to check if the metric implementation just does not exist.
 				status, ok := status.FromError(err)
-				if ok && status.Code() == codes.NotFound {
+				if ok && status.Code() == codes.NotFound &&
+					(strings.Contains(status.Message(), "implementation for metric not found") ||
+						strings.Contains(status.Message(), "metric configuration not found for metric")) {
 					log.Warnf("Resource type %v ignored metric %v because of its missing implementation or default configuration ", key, metric.Id)
 					// In this case, we can continue
 					continue
diff --git a/service/discovery/azure/compute.go b/service/discovery/azure/compute.go
index 23dabb58..e81e62db 100644
--- a/service/discovery/azure/compute.go
+++ b/service/discovery/azure/compute.go
@@ -232,25 +232,25 @@ func (d *azureComputeDiscovery) handleFunction(function *armappservice.Site) voc
 		}
 
 		// Check all runtime versions to get the used runtime language and runtime version
-		if config.Properties.JavaVersion != nil {
+		if util.Deref(config.Properties.JavaVersion) != "" {
 			runtimeLanguage = "Java"
 			runtimeVersion = *config.Properties.JavaVersion
-		} else if config.Properties.NodeVersion != nil {
+		} else if util.Deref(config.Properties.NodeVersion) != "" {
 			runtimeLanguage = "Node.js"
 			runtimeVersion = *config.Properties.NodeVersion
-		} else if config.Properties.PowerShellVersion != nil {
+		} else if util.Deref(config.Properties.PowerShellVersion) != "" {
 			runtimeLanguage = "PowerShell"
 			runtimeVersion = *config.Properties.PowerShellVersion
-		} else if config.Properties.PhpVersion != nil {
+		} else if util.Deref(config.Properties.PhpVersion) != "" {
 			runtimeLanguage = "PHP"
 			runtimeVersion = *config.Properties.PhpVersion
-		} else if config.Properties.PythonVersion != nil {
+		} else if util.Deref(config.Properties.PythonVersion) != "" {
 			runtimeLanguage = "Python"
 			runtimeVersion = *config.Properties.PythonVersion
-		} else if config.Properties.JavaContainer != nil {
+		} else if util.Deref(config.Properties.JavaContainer) != "" {
 			runtimeLanguage = "JavaContainer"
 			runtimeVersion = *config.Properties.JavaContainer
-		} else if config.Properties.NetFrameworkVersion != nil {
+		} else if util.Deref(config.Properties.NetFrameworkVersion) != "" {
 			runtimeLanguage = ".NET"
 			runtimeVersion = *config.Properties.NetFrameworkVersion
 		}
diff --git a/service/orchestrator/assessment_results.go b/service/orchestrator/assessment_results.go
index d0c021db..fc117bbe 100644
--- a/service/orchestrator/assessment_results.go
+++ b/service/orchestrator/assessment_results.go
@@ -188,7 +188,7 @@ func (svc *Service) StoreAssessmentResult(ctx context.Context, req *orchestrator
 		return nil, status.Errorf(codes.Internal, "database error: %v", err)
 	}
 
-	go svc.informHook(req.Result, nil)
+	go svc.informHook(ctx, req.Result, nil)
 
 	res = &orchestrator.StoreAssessmentResultResponse{}
 
@@ -249,20 +249,20 @@ func (s *Service) StoreAssessmentResults(stream orchestrator.Orchestrator_StoreA
 	}
 }
 
-func (s *Service) RegisterAssessmentResultHook(hook func(result *assessment.AssessmentResult, err error)) {
+func (s *Service) RegisterAssessmentResultHook(hook assessment.ResultHookFunc) {
 	s.hookMutex.Lock()
 	defer s.hookMutex.Unlock()
 	s.AssessmentResultHooks = append(s.AssessmentResultHooks, hook)
 }
 
-func (s *Service) informHook(result *assessment.AssessmentResult, err error) {
+func (s *Service) informHook(ctx context.Context, result *assessment.AssessmentResult, err error) {
 	s.mu.Lock()
 	defer s.mu.Unlock()
 	// Inform our hook, if we have any
 	if s.AssessmentResultHooks != nil {
 		for _, hook := range s.AssessmentResultHooks {
 			// TODO(all): We could do hook concurrent again (assuming different hooks don't interfere with each other)
-			hook(result, err)
+			hook(ctx, result, err)
 		}
 	}
 }
diff --git a/service/orchestrator/orchestrator.go b/service/orchestrator/orchestrator.go
index e70433fb..a5e3eaf3 100644
--- a/service/orchestrator/orchestrator.go
+++ b/service/orchestrator/orchestrator.go
@@ -66,7 +66,7 @@ type Service struct {
 	hookMutex sync.RWMutex
 
 	// Hook
-	AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+	AssessmentResultHooks []assessment.ResultHookFunc
 	// mu is used for (un)locking result hook calls
 	mu sync.Mutex
 


Test patch:
diff --git a/service/assessment/benchmark_test.go b/service/assessment/benchmark_test.go
index ecd270fc..ff59528a 100644
--- a/service/assessment/benchmark_test.go
+++ b/service/assessment/benchmark_test.go
@@ -63,7 +63,7 @@ func createEvidences(n int, m int, b *testing.B) int {
 
 	svc := NewService(WithOrchestratorAddress(addr), WithEvidenceStoreAddress(addr))
 
-	orchestratorService.RegisterAssessmentResultHook(func(result *assessment.AssessmentResult, err error) {
+	orchestratorService.RegisterAssessmentResultHook(func(ctx context.Context, result *assessment.AssessmentResult, err error) {
 		wg.Done()
 		current := atomic.AddInt64(&count, 1)
 		log.Debugf("Current count: %v", current)
diff --git a/service/orchestrator/assessment_results_test.go b/service/orchestrator/assessment_results_test.go
index db18a882..cf7e9dbf 100644
--- a/service/orchestrator/assessment_results_test.go
+++ b/service/orchestrator/assessment_results_test.go
@@ -600,14 +600,14 @@ func TestAssessmentResultHook(t *testing.T) {
 	)
 	wg.Add(2)
 
-	firstHookFunction := func(assessmentResult *assessment.AssessmentResult, err error) {
+	firstHookFunction := func(ctx context.Context, assessmentResult *assessment.AssessmentResult, err error) {
 		hookCallCounter++
 		log.Println("Hello from inside the firstHookFunction")
 
 		wg.Done()
 	}
 
-	secondHookFunction := func(assessmentResult *assessment.AssessmentResult, err error) {
+	secondHookFunction := func(ctx context.Context, assessmentResult *assessment.AssessmentResult, err error) {
 		hookCallCounter++
 		log.Println("Hello from inside the secondHookFunction")
 
diff --git a/service/orchestrator/catalogs_test.go b/service/orchestrator/catalogs_test.go
index 9d4a8a5a..1df89345 100644
--- a/service/orchestrator/catalogs_test.go
+++ b/service/orchestrator/catalogs_test.go
@@ -329,7 +329,7 @@ func TestService_RemoveCatalog(t *testing.T) {
 func TestService_GetCategory(t *testing.T) {
 	type fields struct {
 		cloudServiceHooks     []orchestrator.CloudServiceHookFunc
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
@@ -426,7 +426,7 @@ func TestService_GetCategory(t *testing.T) {
 func TestService_GetControl(t *testing.T) {
 	type fields struct {
 		cloudServiceHooks     []orchestrator.CloudServiceHookFunc
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
@@ -556,7 +556,7 @@ func TestService_ListControls(t *testing.T) {
 
 func TestService_loadCatalogs(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
diff --git a/service/orchestrator/certificates_test.go b/service/orchestrator/certificates_test.go
index 165b5fe7..a76e1df3 100644
--- a/service/orchestrator/certificates_test.go
+++ b/service/orchestrator/certificates_test.go
@@ -379,7 +379,7 @@ func TestService_ListPublicCertificates(t *testing.T) {
 		UnimplementedOrchestratorServer orchestrator.UnimplementedOrchestratorServer
 		cloudServiceHooks               []orchestrator.CloudServiceHookFunc
 		toeHooks                        []orchestrator.TargetOfEvaluationHookFunc
-		AssessmentResultHooks           []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks           []assessment.ResultHookFunc
 		storage                         persistence.Storage
 		metricsFile                     string
 		loadMetricsFunc                 func() ([]*assessment.Metric, error)
diff --git a/service/orchestrator/cloud_service_test.go b/service/orchestrator/cloud_service_test.go
index 4bc60fa7..f7a431d0 100644
--- a/service/orchestrator/cloud_service_test.go
+++ b/service/orchestrator/cloud_service_test.go
@@ -383,7 +383,7 @@ func TestService_CreateDefaultTargetCloudService(t *testing.T) {
 
 func TestService_ListCloudServices(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
@@ -531,7 +531,7 @@ func TestService_GetCloudServiceStatistics(t *testing.T) {
 	type fields struct {
 		cloudServiceHooks     []orchestrator.CloudServiceHookFunc
 		toeHooks              []orchestrator.TargetOfEvaluationHookFunc
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
diff --git a/service/orchestrator/metrics_test.go b/service/orchestrator/metrics_test.go
index e1b86b58..d3fff69d 100644
--- a/service/orchestrator/metrics_test.go
+++ b/service/orchestrator/metrics_test.go
@@ -80,7 +80,7 @@ var (
 
 func TestService_loadMetrics(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
@@ -629,7 +629,7 @@ func TestService_ListMetrics(t *testing.T) {
 	type fields struct {
 		cloudServiceHooks     []orchestrator.CloudServiceHookFunc
 		toeHooks              []orchestrator.TargetOfEvaluationHookFunc
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
@@ -701,7 +701,7 @@ func TestService_ListMetrics(t *testing.T) {
 
 func TestService_GetMetricImplementation(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		events                chan *orchestrator.MetricChangeEvent
@@ -798,7 +798,7 @@ func TestService_GetMetricImplementation(t *testing.T) {
 
 func TestService_UpdateMetricImplementation(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		catalogsFolder        string
@@ -929,7 +929,7 @@ func TestService_UpdateMetricImplementation(t *testing.T) {
 
 func TestService_GetMetricConfiguration(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		catalogsFolder        string
@@ -1075,7 +1075,7 @@ func TestService_GetMetricConfiguration(t *testing.T) {
 
 func TestService_ListMetricConfigurations(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		catalogsFolder        string
@@ -1183,7 +1183,7 @@ func TestService_ListMetricConfigurations(t *testing.T) {
 
 func TestService_UpdateMetricConfiguration(t *testing.T) {
 	type fields struct {
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)
diff --git a/service/orchestrator/toe_test.go b/service/orchestrator/toe_test.go
index c1686c57..935d2ec6 100644
--- a/service/orchestrator/toe_test.go
+++ b/service/orchestrator/toe_test.go
@@ -55,7 +55,7 @@ func TestService_CreateTargetOfEvaluation(t *testing.T) {
 
 	type fields struct {
 		cloudServiceHooks     []orchestrator.CloudServiceHookFunc
-		AssessmentResultHooks []func(result *assessment.AssessmentResult, err error)
+		AssessmentResultHooks []assessment.ResultHookFunc
 		storage               persistence.Storage
 		metricsFile           string
 		loadMetricsFunc       func() ([]*assessment.Metric, error)