Repository: clouditor/clouditor
Pull request #431 (2021-12-20 12:29:07)

Minor fixes
Fixed minor things: 
- typos
- error messages
- delete unnecessary code

codecov[bot]: # [Codecov](https://codecov.io/gh/clouditor/clouditor/pull/431?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) Report
> Merging [#431](https://codecov.io/gh/clouditor/clouditor/pull/431?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) (70a1c12) into [main](https://codecov.io/gh/clouditor/clouditor/commit/679b5cbf1c959914caa0751e333e09f6c42b5a74?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) (679b5cb) will **not change** coverage.
> The diff coverage is `27.27%`.

[![Impacted file tree graph](https://codecov.io/gh/clouditor/clouditor/pull/431/graphs/tree.svg?width=650&height=150&src=pr&token=syrXsw5LTX&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor)](https://codecov.io/gh/clouditor/clouditor/pull/431?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor)

```diff
@@           Coverage Diff           @@
##             main     #431   +/-   ##
=======================================
  Coverage   68.73%   68.73%           
=======================================
  Files          39       39           
  Lines        3518     3518           
=======================================
  Hits         2418     2418           
  Misses        977      977           
  Partials      123      123           
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `68.73% <27.27%> (ø)` | |

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://codecov.io/gh/clouditor/clouditor/pull/431?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor) | Coverage Δ | |
|---|---|---|
| [cmd/engine/engine.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-Y21kL2VuZ2luZS9lbmdpbmUuZ28=) | `20.00% <0.00%> (ø)` | |
| [service/discovery/azure/arm\_template.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvYXp1cmUvYXJtX3RlbXBsYXRlLmdv) | `89.26% <ø> (ø)` | |
| [service/discovery/azure/network.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvYXp1cmUvbmV0d29yay5nbw==) | `91.79% <ø> (ø)` | |
| [service/discovery/discovery.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvZGlzY292ZXJ5Lmdv) | `49.35% <0.00%> (ø)` | |
| [service/discovery/k8s/compute.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvazhzL2NvbXB1dGUuZ28=) | `83.72% <0.00%> (ø)` | |
| [service/orchestrator/orchestrator.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9vcmNoZXN0cmF0b3Ivb3JjaGVzdHJhdG9yLmdv) | `78.19% <0.00%> (ø)` | |
| [service/assessment/assessment.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9hc3Nlc3NtZW50L2Fzc2Vzc21lbnQuZ28=) | `86.23% <50.00%> (ø)` | |
| [service/discovery/aws/compute.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvYXdzL2NvbXB1dGUuZ28=) | `100.00% <100.00%> (ø)` | |
| [service/discovery/azure/azure.go](https://codecov.io/gh/clouditor/clouditor/pull/431/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor#diff-c2VydmljZS9kaXNjb3ZlcnkvYXp1cmUvYXp1cmUuZ28=) | `92.10% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/clouditor/clouditor/pull/431?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/clouditor/clouditor/pull/431?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor). Last update [679b5cb...70a1c12](https://codecov.io/gh/clouditor/clouditor/pull/431?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=clouditor).

garuppel: This PR is ready! :smile: 

Patch:
diff --git a/cmd/engine/engine.go b/cmd/engine/engine.go
index 79d80c76..6077c24e 100644
--- a/cmd/engine/engine.go
+++ b/cmd/engine/engine.go
@@ -261,7 +261,7 @@ func doCmd(_ *cobra.Command, _ []string) (err error) {
 
 	// serve the gRPC socket
 	if err := server.Serve(sock); err != nil {
-		log.Infof("failed to serve gRPC endpoint: %s", err)
+		log.Infof("Failed to serve gRPC endpoint: %s", err)
 		return err
 	}
 
diff --git a/service/assessment/assessment.go b/service/assessment/assessment.go
index 91d6c5c8..cee8c6fe 100644
--- a/service/assessment/assessment.go
+++ b/service/assessment/assessment.go
@@ -79,7 +79,7 @@ func (s Service) AssessEvidence(_ context.Context, req *assessment.AssessEvidenc
 			Status: false,
 		}
 
-		return res, status.Errorf(codes.InvalidArgument, "invalid req: %v", err)
+		return res, status.Errorf(codes.InvalidArgument, "invalid req: %v", newError)
 	}
 
 	err = s.handleEvidence(req.Evidence, resourceId)
@@ -136,8 +136,8 @@ func (s Service) handleEvidence(evidence *evidence.Evidence, resourceId string)
 
 	evaluations, err := policies.RunEvidence(evidence)
 	if err != nil {
-		log.Errorf("Could not evaluate evidence: %v", err)
 		newError := fmt.Errorf("could not evaluate evidence: %w", err)
+		log.Errorf(newError.Error())
 
 		s.informHooks(nil, newError)
 
diff --git a/service/discovery/azure/arm_template.go b/service/discovery/azure/arm_template.go
index de65051a..a973258d 100644
--- a/service/discovery/azure/arm_template.go
+++ b/service/discovery/azure/arm_template.go
@@ -104,11 +104,6 @@ func (d *azureARMTemplateDiscovery) discoverARMTemplate() ([]voc.IsCloudResource
 			return nil, fmt.Errorf("could not discover Azure ARM template: %w", err)
 		}
 
-		//err = saveExportTemplate(result, *resourceGroups[i].Name)
-		//if err != nil {
-		//	return nil, fmt.Errorf("could not save Azure ARM template: %w", err)
-		//}
-
 		// TODO Update to latest API version -> GroupsExportTemplateFuture
 		// result = GroupExportResult
 		armTemplate, ok := result.Template.(map[string]interface{})
@@ -168,42 +163,6 @@ func (d *azureARMTemplateDiscovery) discoverARMTemplate() ([]voc.IsCloudResource
 	return list, nil
 }
 
-// saveExportTemplate saves the resource group template in a json file.
-//func saveExportTemplate(template resources.GroupExportResult, groupName string) error {
-//
-//	var (
-//		filepath     string
-//		filename     string
-//		fileTemplate string
-//	)
-//
-//	prefix, indent := "", "    "
-//	exported, err := json.MarshalIndent(template, prefix, indent)
-//	if err != nil {
-//		return fmt.Errorf("MarshalIndent failed %w", err)
-//	}
-//
-//	filepath = "../../results/raw_discovery_results/azure_iac_raw_templates/"
-//	fileTemplate = "%s-template.json"
-//	filename = fmt.Sprintf(fileTemplate, groupName)
-//
-//	// Check if folder exists
-//	err = os.MkdirAll(filepath, os.ModePerm)
-//	if err != nil {
-//		return fmt.Errorf("check for directory existence failed:  %w", err)
-//	}
-//
-//	err = ioutil.WriteFile(filepath+filename, exported, 0666)
-//	if err != nil {
-//		return fmt.Errorf("write file failed %w", err)
-//	} else {
-//		log.Infof("raw Azure ARM template file written to: {%s}{%s}", filepath, filename)
-//
-//	}
-//
-//	return nil
-//}
-
 func (d *azureARMTemplateDiscovery) handleObjectStorage(resourceValue map[string]interface{}, azureResources []interface{}, resourceGroup string) (voc.IsCompute, error) {
 
 	var (
diff --git a/service/discovery/azure/azure.go b/service/discovery/azure/azure.go
index d2debd3d..49a31ee5 100644
--- a/service/discovery/azure/azure.go
+++ b/service/discovery/azure/azure.go
@@ -92,7 +92,7 @@ func (a *azureDiscovery) authorize() (err error) {
 	subClient := subscriptions.NewClient()
 	a.apply(&subClient.Client)
 
-	// get first subcription
+	// get first subscription
 	page, _ := subClient.List(context.Background())
 	a.sub = page.Values()[0]
 
diff --git a/service/discovery/azure/network.go b/service/discovery/azure/network.go
index 4aacc88f..cb1ea982 100644
--- a/service/discovery/azure/network.go
+++ b/service/discovery/azure/network.go
@@ -206,7 +206,7 @@ func LoadBalancerPorts(lb *network.LoadBalancer) (loadBalancerPorts []int16) {
 //	sg, err := client.Get(context.Background(), resourceGroupName(nsgID), strings.Split(nsgID, "/")[8], "")
 //
 //	if err != nil {
-//		log.Errorf("Could not get security group: %s", err)
+//		log.Errorf("Could not get security group: %v", err)
 //		return ""
 //	}
 //
diff --git a/service/discovery/discovery.go b/service/discovery/discovery.go
index 27c2b666..ab7c55d2 100644
--- a/service/discovery/discovery.go
+++ b/service/discovery/discovery.go
@@ -123,19 +123,19 @@ func (s *Service) Start(_ context.Context, _ *discovery.StartDiscoveryRequest) (
 	// create an authorizer from env vars or Azure Managed Service Identity
 	authorizer, err := auth.NewAuthorizerFromCLI()
 	if err != nil {
-		log.Errorf("Could not authenticate to Azure: %s", err)
+		log.Errorf("Could not authenticate to Azure: %v", err)
 		return nil, err
 	}
 
 	k8sClient, err := k8s.AuthFromKubeConfig()
 	if err != nil {
-		log.Errorf("Could not authenticate to Kubernetes: %s", err)
+		log.Errorf("Could not authenticate to Kubernetes: %v", err)
 		return nil, err
 	}
 
 	awsClient, err := aws.NewClient()
 	if err != nil {
-		log.Errorf("Could not load credentials: %s", err)
+		log.Errorf("Could not load credentials: %v", err)
 		return nil, err
 	}
 
@@ -264,32 +264,3 @@ func (s Service) Query(_ context.Context, request *discovery.QueryRequest) (resp
 		Results: &structpb.ListValue{Values: r},
 	}, nil
 }
-
-/*func saveResourcesToFilesystem(result ResultOntology, filename string) error {
-	var (
-		filepath string
-	)
-
-	prefix, indent := "", "    "
-	exported, err := json.MarshalIndent(result, prefix, indent)
-	if err != nil {
-		return fmt.Errorf("marshalling JSON failed %w", err)
-	}
-
-	filepath = "../../results/discovery_results/"
-
-	// Check if folder exists
-	err = os.MkdirAll(filepath, os.ModePerm)
-	if err != nil {
-		return fmt.Errorf("check for directory existence failed:  %w", err)
-	}
-
-	err = ioutil.WriteFile(filepath+filename, exported, 0666)
-	if err != nil {
-		return fmt.Errorf("write file failed %w", err)
-	} else {
-		fmt.Println("ontology resources written to: ", filepath+filename)
-	}
-
-	return nil
-}*/
diff --git a/service/evidence/evidence_store.go b/service/evidence/evidence_store.go
index c60ba7c5..9c48dba6 100644
--- a/service/evidence/evidence_store.go
+++ b/service/evidence/evidence_store.go
@@ -1,3 +1,28 @@
+// Copyright 2016-2020 Fraunhofer AISEC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//           $$\                           $$\ $$\   $$\
+//           $$ |                          $$ |\__|  $$ |
+//  $$$$$$$\ $$ | $$$$$$\  $$\   $$\  $$$$$$$ |$$\ $$$$$$\    $$$$$$\   $$$$$$\
+// $$  _____|$$ |$$  __$$\ $$ |  $$ |$$  __$$ |$$ |\_$$  _|  $$  __$$\ $$  __$$\
+// $$ /      $$ |$$ /  $$ |$$ |  $$ |$$ /  $$ |$$ |  $$ |    $$ /  $$ |$$ | \__|
+// $$ |      $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$\ $$ |  $$ |$$ |
+// \$$$$$$\  $$ |\$$$$$   |\$$$$$   |\$$$$$$  |$$ |  \$$$   |\$$$$$   |$$ |
+//  \_______|\__| \______/  \______/  \_______|\__|   \____/  \______/ \__|
+//
+// This file is part of Clouditor Community Edition.
+
 package evidences
 
 import (
diff --git a/service/orchestrator/orchestrator.go b/service/orchestrator/orchestrator.go
index 66452285..e2dbe6e1 100644
--- a/service/orchestrator/orchestrator.go
+++ b/service/orchestrator/orchestrator.go
@@ -92,7 +92,7 @@ func NewService() *Service {
 
 		b, err := ioutil.ReadFile(fileName)
 		if err != nil {
-			log.Errorf("Could not retrieve default configuration for metric %s: %s. Ignoring metric", m.Id, err)
+			log.Errorf("Could not retrieve default configuration for metric %s: %v. Ignoring metric", m.Id, err)
 			continue
 		}
 
@@ -100,7 +100,7 @@ func NewService() *Service {
 
 		err = json.Unmarshal(b, &config)
 		if err != nil {
-			log.Errorf("Error in reading default configuration for metric %s: %s. Ignoring metric", m.Id, err)
+			log.Errorf("Error in reading default configuration for metric %s: %v. Ignoring metric", m.Id, err)
 			continue
 		}
 


Test patch:
diff --git a/service/assessment/assessment_test.go b/service/assessment/assessment_test.go
index ea10bb34..6a5ff86c 100644
--- a/service/assessment/assessment_test.go
+++ b/service/assessment/assessment_test.go
@@ -28,8 +28,6 @@ package assessment
 import (
 	"clouditor.io/clouditor/api/assessment"
 	"clouditor.io/clouditor/api/evidence"
-	"clouditor.io/clouditor/api/orchestrator"
-	orchestrator_service "clouditor.io/clouditor/service/orchestrator"
 	"clouditor.io/clouditor/voc"
 	"context"
 	"github.com/stretchr/testify/assert"
@@ -85,9 +83,10 @@ func TestAssessEvidence(t *testing.T) {
 		evidence *evidence.Evidence
 	}
 	tests := []struct {
-		name    string
-		args    args
-		wantErr bool
+		name     string
+		args     args
+		wantResp *assessment.AssessEvidenceResponse
+		wantErr  bool
 	}{
 		{
 			name: "Assess resource without id",
@@ -99,6 +98,9 @@ func TestAssessEvidence(t *testing.T) {
 					Resource:  toStruct(voc.VirtualMachine{}, t),
 				},
 			},
+			wantResp: &assessment.AssessEvidenceResponse{
+				Status: false,
+			},
 			wantErr: true,
 		},
 		{
@@ -110,6 +112,9 @@ func TestAssessEvidence(t *testing.T) {
 					Resource:  toStruct(voc.VirtualMachine{}, t),
 				},
 			},
+			wantResp: &assessment.AssessEvidenceResponse{
+				Status: false,
+			},
 			wantErr: true,
 		},
 		{
@@ -121,6 +126,9 @@ func TestAssessEvidence(t *testing.T) {
 					Resource: toStruct(voc.VirtualMachine{}, t),
 				},
 			},
+			wantResp: &assessment.AssessEvidenceResponse{
+				Status: false,
+			},
 			wantErr: true,
 		},
 		{
@@ -133,6 +141,9 @@ func TestAssessEvidence(t *testing.T) {
 					Resource:  toStruct(voc.VirtualMachine{Compute: &voc.Compute{CloudResource: &voc.CloudResource{ID: "my-resource-id", Type: []string{"VirtualMachine"}}}}, t),
 				},
 			},
+			wantResp: &assessment.AssessEvidenceResponse{
+				Status: true,
+			},
 			wantErr: false,
 		},
 	}
@@ -140,11 +151,15 @@ func TestAssessEvidence(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
 			s := NewService()
 
-			_, err := s.AssessEvidence(tt.args.in0, &assessment.AssessEvidenceRequest{Evidence: tt.args.evidence})
+			gotResp, err := s.AssessEvidence(tt.args.in0, &assessment.AssessEvidenceRequest{Evidence: tt.args.evidence})
 			if (err != nil) != tt.wantErr {
 				t.Errorf("AssessEvidence() error = %v, wantErr %v", err, tt.wantErr)
 				return
 			}
+
+			if !reflect.DeepEqual(gotResp, tt.wantResp) {
+				t.Errorf("AssessEvidence() gotResp = %v, want %v", gotResp, tt.wantResp)
+			}
 		})
 	}
 }
@@ -159,10 +174,11 @@ func TestService_AssessEvidences(t *testing.T) {
 		stream assessment.Assessment_AssessEvidencesServer
 	}
 	tests := []struct {
-		name    string
-		fields  fields
-		args    args
-		wantErr bool
+		name           string
+		fields         fields
+		args           args
+		wantErr        bool
+		wantErrMessage string
 	}{
 		{
 			name:   "Assessing evidences fails due to missing toolId",
@@ -173,7 +189,8 @@ func TestService_AssessEvidences(t *testing.T) {
 					Resource:  toStruct(voc.VirtualMachine{Compute: &voc.Compute{CloudResource: &voc.CloudResource{ID: "my-resource-id", Type: []string{"VirtualMachine"}}}}, t),
 				},
 			}},
-			wantErr: true,
+			wantErr:        true,
+			wantErrMessage: "invalid evidence",
 		},
 		{
 			name:   "Assess evidences",
@@ -185,7 +202,8 @@ func TestService_AssessEvidences(t *testing.T) {
 					Resource:  toStruct(voc.VirtualMachine{Compute: &voc.Compute{CloudResource: &voc.CloudResource{ID: "my-resource-id", Type: []string{"VirtualMachine"}}}}, t),
 				},
 			}},
-			wantErr: false,
+			wantErr:        false,
+			wantErrMessage: "",
 		},
 	}
 	for _, tt := range tests {
@@ -200,6 +218,10 @@ func TestService_AssessEvidences(t *testing.T) {
 				t.Errorf("AssessEvidence() error = %v, wantErr %v", err, tt.wantErr)
 				return
 			}
+
+			if err != nil {
+				assert.Contains(t, err.Error(), tt.wantErrMessage)
+			}
 		})
 	}
 }
@@ -207,8 +229,6 @@ func TestService_AssessEvidences(t *testing.T) {
 func TestAssessmentResultHooks(t *testing.T) {
 	var (
 		hookCallCounter = 0
-		// Service needs to outlive the lifetime of the hook function
-		service = *orchestrator_service.NewService()
 	)
 
 	firstHookFunction := func(assessmentResult *assessment.AssessmentResult, err error) {
@@ -221,27 +241,6 @@ func TestAssessmentResultHooks(t *testing.T) {
 		log.Println("Hello from inside the secondHookFunction")
 	}
 
-	// TODO(garuppel): Delete that test after adding an additional test for assessment.Validate()
-	storeAssessmentResultToOrchestrator := func(result *assessment.AssessmentResult, err error) {
-
-		hookCallCounter++
-
-		if err != nil {
-			log.Println("error as input %w: ", err)
-			log.Infof("stop hook for storing assessment result")
-			return
-		}
-
-		_, err = service.StoreAssessmentResult(context.Background(), &orchestrator.StoreAssessmentResultRequest{
-			Result: result})
-
-		if err != nil {
-			log.Errorf("error storing assessment result in orchestrator: %v", err)
-		} else {
-			log.Infof("assessment result stored in orchestrator")
-		}
-	}
-
 	// Check GRPC call
 	type args struct {
 		in0         context.Context
@@ -271,7 +270,8 @@ func TestAssessmentResultHooks(t *testing.T) {
 							},
 						}, t),
 					}},
-				resultHooks: []assessment.ResultHookFunc{storeAssessmentResultToOrchestrator, firstHookFunction, secondHookFunction},
+
+				resultHooks: []assessment.ResultHookFunc{firstHookFunction, secondHookFunction},
 			},
 			wantErr:  false,
 			wantResp: &assessment.AssessEvidenceResponse{Status: true},
@@ -298,14 +298,14 @@ func TestAssessmentResultHooks(t *testing.T) {
 			time.Sleep(3 * time.Second)
 
 			if (err != nil) != tt.wantErr {
-				t.Errorf("StoreAssessmentResult() error = %v, wantErr %v", err, tt.wantErr)
+				t.Errorf("AssessEvidence() error = %v, wantErr %v", err, tt.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(gotResp, tt.wantResp) {
-				t.Errorf("StoreAssessmentResult() gotResp = %v, want %v", gotResp, tt.wantResp)
+				t.Errorf("AssessEvidence() gotResp = %v, want %v", gotResp, tt.wantResp)
 			}
 			assert.NotEmpty(t, s.results)
-			assert.Equal(t, 18, hookCallCounter) //
+			assert.Equal(t, 12, hookCallCounter)
 		})
 	}
 }
diff --git a/service/discovery/discovery_test.go b/service/discovery/discovery_test.go
index a34abc3c..b66c506c 100644
--- a/service/discovery/discovery_test.go
+++ b/service/discovery/discovery_test.go
@@ -173,6 +173,14 @@ func TestQuery(t *testing.T) {
 
 }
 
+func TestShutdown(t *testing.T) {
+	service := NewService()
+	service.Shutdown()
+
+	assert.False(t, service.scheduler.IsRunning())
+
+}
+
 // mockDiscoverer implements Discoverer and mocks the API to cloud resources
 type mockDiscoverer struct {
 	// testCase allows for different implementations for table tests in TestStartDiscovery
@@ -184,7 +192,7 @@ func (m mockDiscoverer) Name() string { return "just mocking" }
 func (m mockDiscoverer) List() ([]voc.IsCloudResource, error) {
 	switch m.testCase {
 	case 0:
-		return nil, fmt.Errorf("mock Error in List()")
+		return nil, fmt.Errorf("mock error in List()")
 	case 1:
 		return []voc.IsCloudResource{wrongFormattedResource()}, nil
 	case 2:
@@ -231,7 +239,7 @@ func (m *mockAssessmentStream) Send(req *assessment.AssessEvidenceRequest) (err
 	if m.connectionEstablished {
 		m.sentEvidence = e
 	} else {
-		err = fmt.Errorf("MocK Send error")
+		err = fmt.Errorf("mock send error")
 	}
 	return
 }
@@ -269,7 +277,7 @@ type mockEvidenceStoreStream struct {
 }
 
 func (mockEvidenceStoreStream) Send(_ *evidence.StoreEvidenceRequest) error {
-	return fmt.Errorf("MocK Send error")
+	return fmt.Errorf("mock send error")
 }
 
 func (mockEvidenceStoreStream) CloseAndRecv() (*emptypb.Empty, error) {
diff --git a/service/evidence/evidence_store_test.go b/service/evidence/evidence_store_test.go
index 6af618b3..29049feb 100644
--- a/service/evidence/evidence_store_test.go
+++ b/service/evidence/evidence_store_test.go
@@ -1,3 +1,28 @@
+// Copyright 2016-2020 Fraunhofer AISEC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//           $$\                           $$\ $$\   $$\
+//           $$ |                          $$ |\__|  $$ |
+//  $$$$$$$\ $$ | $$$$$$\  $$\   $$\  $$$$$$$ |$$\ $$$$$$\    $$$$$$\   $$$$$$\
+// $$  _____|$$ |$$  __$$\ $$ |  $$ |$$  __$$ |$$ |\_$$  _|  $$  __$$\ $$  __$$\
+// $$ /      $$ |$$ /  $$ |$$ |  $$ |$$ /  $$ |$$ |  $$ |    $$ /  $$ |$$ | \__|
+// $$ |      $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$ |  $$ |$$\ $$ |  $$ |$$ |
+// \$$$$$$\  $$ |\$$$$$   |\$$$$$   |\$$$$$$  |$$ |  \$$$   |\$$$$$   |$$ |
+//  \_______|\__| \______/  \______/  \_______|\__|   \____/  \______/ \__|
+//
+// This file is part of Clouditor Community Edition.
+
 package evidences
 
 import (