Repository: datreeio/datree
Pull request #49 (2021-05-25 13:23:33)

main


Patch:
diff --git a/bl/evaluation/evaluator.go b/bl/evaluation/evaluator.go
index 65d7e1d..d9eb96a 100644
--- a/bl/evaluation/evaluator.go
+++ b/bl/evaluation/evaluator.go
@@ -8,7 +8,7 @@ import (
 
 type CLIClient interface {
 	RequestEvaluation(request *cliClient.EvaluationRequest) (*cliClient.EvaluationResponse, error)
-	CreateEvaluation(request *cliClient.CreateEvaluationRequest) (int, error)
+	CreateEvaluation(request *cliClient.CreateEvaluationRequest) (*cliClient.CreateEvaluationResponse, error)
 	UpdateEvaluationValidation(request *cliClient.UpdateEvaluationValidationRequest) error
 }
 
@@ -40,9 +40,9 @@ type Error struct {
 	Filename string
 }
 
-func (e *Evaluator) CreateEvaluation(cliId string, cliVersion string, k8sVersion string) (int, error) {
-	evaluationId, err := e.cliClient.CreateEvaluation(&cliClient.CreateEvaluationRequest{
-		K8sVersion: k8sVersion,
+func (e *Evaluator) CreateEvaluation(cliId string, cliVersion string, k8sVersion string) (*cliClient.CreateEvaluationResponse, error) {
+	createEvaluationResponse, err := e.cliClient.CreateEvaluation(&cliClient.CreateEvaluationRequest{
+		K8sVersion: &k8sVersion,
 		CliId:      cliId,
 		Metadata: &cliClient.Metadata{
 			CliVersion:      cliVersion,
@@ -52,7 +52,7 @@ func (e *Evaluator) CreateEvaluation(cliId string, cliVersion string, k8sVersion
 		},
 	})
 
-	return evaluationId, err
+	return createEvaluationResponse, err
 }
 
 func (e *Evaluator) Evaluate(validFilesPathsChan chan string, invalidFilesPathsChan chan *validation.InvalidFile, evaluationId int) (*EvaluationResults, []*validation.InvalidFile, []*extractor.FileConfiguration, []*Error, error) {
diff --git a/bl/validation/k8sValidator.go b/bl/validation/k8sValidator.go
index b9b8e9a..8a01a04 100644
--- a/bl/validation/k8sValidator.go
+++ b/bl/validation/k8sValidator.go
@@ -17,11 +17,8 @@ type K8sValidator struct {
 	validationClient ValidationClient
 }
 
-func New(k8sVersion string) *K8sValidator {
-	kubconformClient := newKubconformValidator(k8sVersion)
-	return &K8sValidator{
-		validationClient: kubconformClient,
-	}
+func New() *K8sValidator {
+	return &K8sValidator{}
 }
 
 type InvalidFile struct {
@@ -29,6 +26,10 @@ type InvalidFile struct {
 	ValidationErrors []error
 }
 
+func (val *K8sValidator) InitClient(k8sVersion string) {
+	val.validationClient = newKubconformValidator(k8sVersion)
+}
+
 func (val *K8sValidator) ValidateResources(paths []string) (chan string, chan *InvalidFile, chan error) {
 	pathsChan := files.ToAbsolutePaths(paths)
 
diff --git a/cmd/root.go b/cmd/root.go
index 77b378c..4bdcfad 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -3,6 +3,7 @@ package cmd
 import (
 	"github.com/datreeio/datree/bl/evaluation"
 	"github.com/datreeio/datree/bl/messager"
+	"github.com/datreeio/datree/bl/validation"
 	"github.com/datreeio/datree/cmd/test"
 	"github.com/datreeio/datree/cmd/version"
 	"github.com/datreeio/datree/pkg/cliClient"
@@ -25,12 +26,13 @@ func init() {
 	app := startup()
 
 	rootCmd.AddCommand(test.New(&test.TestCommandContext{
-		CliVersion:  CliVersion,
-		Evaluator:   app.context.Evaluator,
-		LocalConfig: app.context.LocalConfig,
-		Messager:    app.context.Messager,
-		Printer:     app.context.Printer,
-		Reader:      app.context.Reader,
+		CliVersion:   CliVersion,
+		Evaluator:    app.context.Evaluator,
+		LocalConfig:  app.context.LocalConfig,
+		Messager:     app.context.Messager,
+		Printer:      app.context.Printer,
+		Reader:       app.context.Reader,
+		K8sValidator: app.context.K8sValidator,
 	}))
 
 	rootCmd.AddCommand(version.New(&version.VersionCommandContext{
@@ -45,12 +47,13 @@ func Execute() error {
 }
 
 type context struct {
-	LocalConfig *localConfig.LocalConfiguration
-	Evaluator   *evaluation.Evaluator
-	CliClient   *cliClient.CliClient
-	Messager    *messager.Messager
-	Printer     *printer.Printer
-	Reader      *fileReader.FileReader
+	LocalConfig  *localConfig.LocalConfiguration
+	Evaluator    *evaluation.Evaluator
+	CliClient    *cliClient.CliClient
+	Messager     *messager.Messager
+	Printer      *printer.Printer
+	Reader       *fileReader.FileReader
+	K8sValidator *validation.K8sValidator
 }
 
 type app struct {
@@ -64,12 +67,13 @@ func startup() *app {
 
 	return &app{
 		context: &context{
-			LocalConfig: config,
-			Evaluator:   evaluation.New(cliClient),
-			CliClient:   cliClient,
-			Messager:    messager.New(cliClient),
-			Printer:     printer,
-			Reader:      fileReader.CreateFileReader(nil),
+			LocalConfig:  config,
+			Evaluator:    evaluation.New(cliClient),
+			CliClient:    cliClient,
+			Messager:     messager.New(cliClient),
+			Printer:      printer,
+			Reader:       fileReader.CreateFileReader(nil),
+			K8sValidator: validation.New(),
 		},
 	}
 }
diff --git a/pkg/cliClient/evaluation.go b/pkg/cliClient/evaluation.go
index d473c57..785984a 100644
--- a/pkg/cliClient/evaluation.go
+++ b/pkg/cliClient/evaluation.go
@@ -2,8 +2,9 @@ package cliClient
 
 import (
 	"encoding/json"
-	"github.com/datreeio/datree/pkg/extractor"
 	"net/http"
+
+	"github.com/datreeio/datree/pkg/extractor"
 )
 
 type Metadata struct {
@@ -16,26 +17,27 @@ type Metadata struct {
 type CreateEvaluationRequest struct {
 	CliId      string    `json:"cliId"`
 	Metadata   *Metadata `json:"metadata"`
-	K8sVersion string    `json:"k8sVersion"`
+	K8sVersion *string   `json:"k8sVersion"`
 }
 
 type CreateEvaluationResponse struct {
-	EvaluationId int `json:"evaluationId"`
+	EvaluationId int    `json:"evaluationId"`
+	K8sVersion   string `json:"k8sVersion"`
 }
 
-func (c *CliClient) CreateEvaluation(request *CreateEvaluationRequest) (int, error) {
+func (c *CliClient) CreateEvaluation(request *CreateEvaluationRequest) (*CreateEvaluationResponse, error) {
 	httpRes, err := c.httpClient.Request(http.MethodPost, "/cli/evaluation/create", request, nil)
 	if err != nil {
-		return 0, err
+		return nil, err
 	}
 
 	var res = &CreateEvaluationResponse{}
 	err = json.Unmarshal(httpRes.Body, &res)
 	if err != nil {
-		return 0, err
+		return nil, err
 	}
 
-	return res.EvaluationId, nil
+	return res, nil
 }
 
 type Match struct {
diff --git a/pkg/fileReader/reader.go b/pkg/fileReader/reader.go
index be66c2c..f7dc62b 100644
--- a/pkg/fileReader/reader.go
+++ b/pkg/fileReader/reader.go
@@ -56,18 +56,21 @@ func CreateFileReader(opts *FileReaderOptions) *FileReader {
 	return fileReader
 }
 
-func (fr *FileReader) FilterFiles(paths []string) []string {
+func (fr *FileReader) FilterFiles(paths []string) ([]string, error) {
 	var filePaths []string
 
 	for _, path := range paths {
-		stat, _ := fr.stat(path)
+		stat, err := fr.stat(path)
+		if err != nil {
+			return []string{}, err
+		}
 
 		if !stat.IsDir() {
 			filePaths = append(filePaths, path)
 		}
 	}
 
-	return filePaths
+	return filePaths, nil
 }
 
 func (fr *FileReader) ReadFileContent(filepath string) (string, error) {


Test patch:
diff --git a/bl/evaluation/evaluator_test.go b/bl/evaluation/evaluator_test.go
index 1ebb56b..1d7e01c 100644
--- a/bl/evaluation/evaluator_test.go
+++ b/bl/evaluation/evaluator_test.go
@@ -1,10 +1,11 @@
 package evaluation
 
 import (
-	"github.com/datreeio/datree/bl/validation"
 	"path/filepath"
 	"testing"
 
+	"github.com/datreeio/datree/bl/validation"
+
 	"github.com/datreeio/datree/pkg/cliClient"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
@@ -14,9 +15,9 @@ type mockCliClient struct {
 	mock.Mock
 }
 
-func (m *mockCliClient) CreateEvaluation(createEvaluationRequest *cliClient.CreateEvaluationRequest) (int, error) {
+func (m *mockCliClient) CreateEvaluation(createEvaluationRequest *cliClient.CreateEvaluationRequest) (*cliClient.CreateEvaluationResponse, error) {
 	args := m.Called(createEvaluationRequest)
-	return args.Get(0).(int), args.Error(1)
+	return args.Get(0).(*cliClient.CreateEvaluationResponse), args.Error(1)
 }
 
 func (m *mockCliClient) RequestEvaluation(evaluationRequest *cliClient.EvaluationRequest) (*cliClient.EvaluationResponse, error) {
@@ -37,6 +38,7 @@ func (m *mockCliClient) GetVersionMessage(cliVersion string, timeout int) (*cliC
 type cliClientMockTestCase struct {
 	createEvaluation struct {
 		evaluationId int
+		k8sVersion   string
 		err          error
 	}
 	requestEvaluation struct {
@@ -62,7 +64,7 @@ func TestEvaluate(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
 			mockedCliClient := &mockCliClient{}
 
-			mockedCliClient.On("CreateEvaluation", mock.Anything).Return(tt.mock.cliClient.createEvaluation.evaluationId, tt.mock.cliClient.createEvaluation.err)
+			mockedCliClient.On("CreateEvaluation", mock.Anything).Return(tt.mock.cliClient.createEvaluation, tt.mock.cliClient.createEvaluation.err)
 			mockedCliClient.On("UpdateEvaluationValidation", mock.Anything).Return(nil)
 
 			evaluator := &Evaluator{
@@ -163,6 +165,7 @@ func request_evaluation_all_valid() *evaluateTestCase {
 			cliClient: &cliClientMockTestCase{
 				createEvaluation: struct {
 					evaluationId int
+					k8sVersion   string
 					err          error
 				}{
 					evaluationId: 1,
@@ -230,6 +233,7 @@ func request_evaluation_all_invalid() *evaluateTestCase {
 			cliClient: &cliClientMockTestCase{
 				createEvaluation: struct {
 					evaluationId int
+					k8sVersion   string
 					err          error
 				}{
 					evaluationId: 1,
diff --git a/cmd/test/main.go b/cmd/test/main.go
index e80cfce..ee9a2bc 100644
--- a/cmd/test/main.go
+++ b/cmd/test/main.go
@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"time"
 
+	"github.com/datreeio/datree/pkg/cliClient"
 	"github.com/datreeio/datree/pkg/extractor"
 
 	"github.com/briandowns/spinner"
@@ -17,7 +18,7 @@ import (
 
 type Evaluator interface {
 	Evaluate(validFilesPathsChan chan string, invalidFilesPaths chan *validation.InvalidFile, evaluationId int) (*evaluation.EvaluationResults, []*validation.InvalidFile, []*extractor.FileConfiguration, []*evaluation.Error, error)
-	CreateEvaluation(cliId string, cliVersion string, k8sVersion string) (int, error)
+	CreateEvaluation(cliId string, cliVersion string, k8sVersion string) (*cliClient.CreateEvaluationResponse, error)
 }
 
 type Messager interface {
@@ -26,6 +27,7 @@ type Messager interface {
 
 type K8sValidator interface {
 	ValidateResources(paths []string) (chan string, chan *validation.InvalidFile, chan error)
+	InitClient(k8sVersion string)
 }
 
 type TestCommandFlags struct {
@@ -41,7 +43,7 @@ type EvaluationPrinter interface {
 }
 
 type Reader interface {
-	FilterFiles(paths []string) []string
+	FilterFiles(paths []string) ([]string, error)
 }
 
 type TestCommandContext struct {
@@ -73,7 +75,6 @@ func New(ctx *TestCommandContext) *cobra.Command {
 			}
 
 			testCommandFlags := TestCommandFlags{Output: outputFlag, K8sVersion: k8sVersion}
-			ctx.K8sValidator = validation.New(k8sVersion)
 			return test(ctx, args, testCommandFlags)
 		},
 		SilenceUsage:  true,
@@ -81,12 +82,13 @@ func New(ctx *TestCommandContext) *cobra.Command {
 	}
 
 	testCommand.Flags().StringP("output", "o", "", "Define output format")
-	testCommand.Flags().StringP("schema-version", "s", "1.18.0", "Set kubernetes version to validate against. Defaults to 1.18.0")
+	testCommand.Flags().StringP("schema-version", "s", "", "Set kubernetes version to validate against. Defaults to 1.18.0")
 	return testCommand
 }
 
 func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error {
 	messages := make(chan *messager.VersionMessage, 1)
+	go ctx.Messager.LoadVersionMessages(messages, ctx.CliVersion)
 	defer func() {
 		msg, ok := <-messages
 		if ok {
@@ -94,7 +96,11 @@ func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error
 		}
 	}()
 
-	filePaths := ctx.Reader.FilterFiles(paths)
+	filePaths, err := ctx.Reader.FilterFiles(paths)
+	if err != nil {
+		fmt.Println(err.Error())
+		return err
+	}
 	if len(filePaths) == 0 {
 		noFilesErr := fmt.Errorf("No files detected")
 		fmt.Println(noFilesErr.Error())
@@ -104,22 +110,21 @@ func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error
 	spinner := createSpinner(" Loading...", "cyan")
 	spinner.Start()
 
-	go ctx.Messager.LoadVersionMessages(messages, ctx.CliVersion)
-
-	evaluationId, err := ctx.Evaluator.CreateEvaluation(ctx.LocalConfig.CliId, ctx.CliVersion, flags.K8sVersion)
+	createEvaluationResponse, err := ctx.Evaluator.CreateEvaluation(ctx.LocalConfig.CliId, ctx.CliVersion, flags.K8sVersion)
 	if err != nil {
 		fmt.Println(err.Error())
 		return err
 	}
 
+	ctx.K8sValidator.InitClient(createEvaluationResponse.K8sVersion)
 	validFilesPathsChan, invalidFilesPathsChan, errorsChan := ctx.K8sValidator.ValidateResources(paths)
 	go func() {
 		for err := range errorsChan {
-			fmt.Println(err)
+			fmt.Println(err.Error())
 		}
 	}()
 
-	results, invalidFiles, filesConfigurations, errors, err := ctx.Evaluator.Evaluate(validFilesPathsChan, invalidFilesPathsChan, evaluationId)
+	results, invalidFiles, filesConfigurations, errors, err := ctx.Evaluator.Evaluate(validFilesPathsChan, invalidFilesPathsChan, createEvaluationResponse.EvaluationId)
 
 	spinner.Stop()
 
@@ -135,7 +140,7 @@ func test(ctx *TestCommandContext, paths []string, flags TestCommandFlags) error
 		PassedPolicyCheckCount:    passedPolicyCheckCount,
 	}
 
-	err = evaluation.PrintResults(results, invalidFiles, evaluationSummary, fmt.Sprintf("https://app.datree.io/login?cliId=%s", ctx.LocalConfig.CliId), flags.Output, ctx.Printer, flags.K8sVersion)
+	err = evaluation.PrintResults(results, invalidFiles, evaluationSummary, fmt.Sprintf("https://app.datree.io/login?cliId=%s", ctx.LocalConfig.CliId), flags.Output, ctx.Printer, createEvaluationResponse.K8sVersion)
 
 	var invocationFailedErr error = nil
 
diff --git a/cmd/test/main_test.go b/cmd/test/main_test.go
index 1f42809..889772b 100644
--- a/cmd/test/main_test.go
+++ b/cmd/test/main_test.go
@@ -4,6 +4,7 @@ import (
 	"testing"
 
 	"github.com/datreeio/datree/bl/validation"
+	"github.com/datreeio/datree/pkg/cliClient"
 	"github.com/datreeio/datree/pkg/extractor"
 	"github.com/datreeio/datree/pkg/printer"
 
@@ -22,9 +23,9 @@ func (m *mockEvaluator) Evaluate(validFilesPathsChan chan string, invalidFilesPa
 	return args.Get(0).(*evaluation.EvaluationResults), args.Get(1).([]*validation.InvalidFile), args.Get(2).([]*extractor.FileConfiguration), args.Get(3).([]*evaluation.Error), args.Error(4)
 }
 
-func (m *mockEvaluator) CreateEvaluation(cliId string, cliVersion string, k8sVersion string) (int, error) {
+func (m *mockEvaluator) CreateEvaluation(cliId string, cliVersion string, k8sVersion string) (*cliClient.CreateEvaluationResponse, error) {
 	args := m.Called(cliId, cliVersion, k8sVersion)
-	return args.Get(0).(int), args.Error(1)
+	return args.Get(0).(*cliClient.CreateEvaluationResponse), args.Error(1)
 }
 
 type mockMessager struct {
@@ -56,6 +57,9 @@ func (kv *K8sValidatorMock) ValidateResources(paths []string) (chan string, chan
 	return args.Get(0).(chan string), args.Get(1).(chan *validation.InvalidFile), args.Get(2).(chan error)
 }
 
+func (kv *K8sValidatorMock) InitClient(k8sVersion string) {
+}
+
 type PrinterMock struct {
 	mock.Mock
 }
@@ -80,9 +84,9 @@ type ReaderMock struct {
 	mock.Mock
 }
 
-func (rm *ReaderMock) FilterFiles(paths []string) []string {
+func (rm *ReaderMock) FilterFiles(paths []string) ([]string, error) {
 	args := rm.Called(paths)
-	return args.Get(0).([]string)
+	return args.Get(0).([]string), nil
 }
 
 func TestTestCommand(t *testing.T) {
@@ -103,8 +107,7 @@ func TestTestCommand(t *testing.T) {
 
 	mockedEvaluator := &mockEvaluator{}
 	mockedEvaluator.On("Evaluate", mock.Anything, mock.Anything, mock.Anything).Return(evaluationResults, invalidFiles, fileConfigurations, evaluationErrors, nil)
-	mockedEvaluator.On("CreateEvaluation", mock.Anything, mock.Anything, mock.Anything).Return(evaluationId, nil)
-
+	mockedEvaluator.On("CreateEvaluation", mock.Anything, mock.Anything, mock.Anything).Return(&cliClient.CreateEvaluationResponse{EvaluationId: evaluationId, K8sVersion: "1.18.0"}, nil)
 	messager := &mockMessager{}
 	messager.On("LoadVersionMessages", mock.Anything, mock.Anything)
 
@@ -114,6 +117,7 @@ func TestTestCommand(t *testing.T) {
 	invalidFilesChan := newInvalidFilesChan()
 
 	k8sValidatorMock.On("ValidateResources", mock.Anything).Return(validFilesPathChan, invalidFilesChan, newErrorsChan())
+	k8sValidatorMock.On("InitClient", mock.Anything).Return()
 
 	printerMock := &PrinterMock{}
 	printerMock.On("PrintWarnings", mock.Anything)
@@ -123,7 +127,7 @@ func TestTestCommand(t *testing.T) {
 
 	readerMock := &ReaderMock{}
 
-	readerMock.On("FilterFiles", mock.Anything).Return([]string{"file/path"})
+	readerMock.On("FilterFiles", mock.Anything).Return([]string{"file/path"}, nil)
 
 	ctx := &TestCommandContext{
 		K8sValidator: k8sValidatorMock,
@@ -140,7 +144,7 @@ func TestTestCommand(t *testing.T) {
 }
 
 func test_testCommand_no_flags(t *testing.T, evaluator *mockEvaluator, validFilesPathChan chan string, invalidFilesChan chan *validation.InvalidFile, evaluationId int, ctx *TestCommandContext) {
-	test(ctx, []string{"8/*"}, TestCommandFlags{})
+	test(ctx, []string{"8/*"}, TestCommandFlags{K8sVersion: "", Output: ""})
 
 	evaluator.AssertCalled(t, "Evaluate", validFilesPathChan, invalidFilesChan, evaluationId)
 	evaluator.AssertNotCalled(t, "PrintFileParsingErrors")
diff --git a/pkg/cliClient/cliClient_test.go b/pkg/cliClient/cliClient_test.go
index 27d750a..0ee3a97 100644
--- a/pkg/cliClient/cliClient_test.go
+++ b/pkg/cliClient/cliClient_test.go
@@ -3,12 +3,13 @@ package cliClient
 import (
 	"bytes"
 	"encoding/json"
-	"gopkg.in/yaml.v3"
 	"io/ioutil"
 	"net/http"
 	"path/filepath"
 	"testing"
 
+	"gopkg.in/yaml.v3"
+
 	"github.com/datreeio/datree/pkg/extractor"
 	"github.com/datreeio/datree/pkg/httpClient"
 	"github.com/stretchr/testify/assert"
@@ -25,7 +26,7 @@ func (c *mockHTTPClient) Request(method string, resourceURI string, body interfa
 	return args.Get(0).(httpClient.Response), args.Error(1)
 }
 
-func (c *mockHTTPClient) name()  {
+func (c *mockHTTPClient) name() {
 
 }
 
@@ -140,11 +141,10 @@ func TestCreateRequestEvaluation(t *testing.T) {
 				httpClient: &httpClientMock,
 			}
 
-			actualEvaluationId, _ := client.CreateEvaluation(tt.args.createEvaluationRequest)
+			res, _ := client.CreateEvaluation(tt.args.createEvaluationRequest)
 
 			httpClientMock.AssertCalled(t, "Request", tt.expected.request.method, tt.expected.request.uri, tt.expected.request.body, tt.expected.request.headers)
-			assert.Equal(t, tt.expected.response.EvaluationId, actualEvaluationId)
-
+			assert.Equal(t, tt.expected.response, res)
 		})
 	}
 }
@@ -161,9 +161,8 @@ func TestGetVersionMessage(t *testing.T) {
 			mockedHTTPResponse := httpClient.Response{StatusCode: tt.mock.response.status, Body: body}
 			httpClientMock.On("Request", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(mockedHTTPResponse, nil)
 
-
 			client := &CliClient{
-				baseUrl:    "http://cli-service.test.io",
+				baseUrl:       "http://cli-service.test.io",
 				timeoutClient: &httpClientMock,
 			}
 
@@ -312,13 +311,16 @@ func test_requestEvaluation_success() *RequestEvaluationTestCase {
 }
 
 func test_createEvaluation_success() *CreateEvaluationTestCase {
+	k8sVersion := "1.18.0"
+
 	return &CreateEvaluationTestCase{
 		name: "success - create evaluation",
 		args: struct {
 			createEvaluationRequest *CreateEvaluationRequest
 		}{
 			createEvaluationRequest: &CreateEvaluationRequest{
-				CliId: "cli_id",
+				K8sVersion: &k8sVersion,
+				CliId:      "cli_id",
 				Metadata: &Metadata{
 					CliVersion:      "0.0.1",
 					Os:              "darwin",
@@ -340,6 +342,7 @@ func test_createEvaluation_success() *CreateEvaluationTestCase {
 				status: http.StatusOK,
 				body: &CreateEvaluationResponse{
 					EvaluationId: 123,
+					K8sVersion:   k8sVersion,
 				},
 			},
 		},
@@ -361,7 +364,8 @@ func test_createEvaluation_success() *CreateEvaluationTestCase {
 				method: http.MethodPost,
 				uri:    "/cli/evaluation/create",
 				body: &CreateEvaluationRequest{
-					CliId: "cli_id",
+					K8sVersion: &k8sVersion,
+					CliId:      "cli_id",
 					Metadata: &Metadata{
 						CliVersion:      "0.0.1",
 						Os:              "darwin",
@@ -373,6 +377,7 @@ func test_createEvaluation_success() *CreateEvaluationTestCase {
 			},
 			response: &CreateEvaluationResponse{
 				EvaluationId: 123,
+				K8sVersion:   k8sVersion,
 			},
 		},
 	}