Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Missing cli e2e tests implementation #2461

Merged
merged 3 commits into from Jul 26, 2021
Merged

test: Missing cli e2e tests implementation #2461

merged 3 commits into from Jul 26, 2021

Conversation

vsokolovskii
Copy link
Contributor

@vsokolovskii vsokolovskii commented Jun 28, 2021

@squakez
Copy link
Contributor

squakez commented Jul 12, 2021

I think the test spotted an hidden issue:

=== RUN   TestKamelCLIBind/bind_timer_to_log
KameletBinding.camel.apache.org "test-timer-source-to-log" is invalid: []: Invalid value: map[string]interface {}{"kind":"KameletBinding", "apiVersion":"camel.apache.org/v1alpha1", "metadata":map[string]interface {}{"uid":"2948e0fe-e2f1-11eb-b545-000d3a02688e", "selfLink":"", "clusterName":"", "name":"test-timer-source-to-log", "namespace":"test-6a95d672-8ac8-4df7-8688-1eacb6220973", "creationTimestamp":"2021-07-12T09:11:37Z", "generation":1}, "spec":map[string]interface {}{"source":map[string]interface {}{"ref":map[string]interface {}{"kind":"Kamelet", "namespace":"test-6a95d672-8ac8-4df7-8688-1eacb6220973", "name":"test-timer-source", "apiVersion":"camel.apache.org/v1alpha1"}, "properties":map[string]interface {}{"message":"helloTest"}}, "sink":map[string]interface {}{"uri":"log:info"}, "errorHandler":interface {}(nil)}}: validation failure list:
spec.errorHandler in body must be of type object: "null"

Probably the bind operation is setting a null error handler, when instead it should be omitted as empty.

@squakez
Copy link
Contributor

squakez commented Jul 12, 2021

Should be rebased after #2496 is merged.

@squakez
Copy link
Contributor

squakez commented Jul 15, 2021

Please @vsokolov00, rebase this PR to see if now the test pass correctly.

@vsokolovskii
Copy link
Contributor Author

@squakez pr is ready to merge! :)

@astefanutti
Copy link
Member

@vsokolov00 could you please run go fmt over the modified files?

@vsokolovskii
Copy link
Contributor Author

vsokolovskii commented Jul 23, 2021

     cli git:(missing-cli-e2e-tests) ✗ go fmt bind_test.go 
     cli git:(missing-cli-e2e-tests) ✗ go fmt log_test.go
     support git:(missing-cli-e2e-tests) ✗ go fmt test_support.go

Empty output @astefanutti

@astefanutti
Copy link
Member

@vsokolov00 when I run for example go fmt ./e2e/support locally I get:

func GetOutputStringAsync(cmd *cobra.Command) func() string {
	var buffer bytes.Buffer
	stdout := bufio.NewWriter(&buffer)

	cmd.SetOut(stdout)
	go cmd.Execute()

	return func() string {
		return buffer.String()
	}
}

compared to:

func GetOutputStringAsync(cmd *cobra.Command) func () string {
	var buffer bytes.Buffer
	stdout := bufio.NewWriter(&buffer)

	cmd.SetOut(stdout)
	go cmd.Execute()

	return func () string{
		return buffer.String()
	}
}

I think go fmt takes packages as input rather than individual files.

@vsokolovskii
Copy link
Contributor Author

You are right, it should be executed over the whole packages (also it automatically edits problem code) @astefanutti

@astefanutti astefanutti merged commit b415f92 into apache:main Jul 26, 2021
@vsokolovskii vsokolovskii deleted the missing-cli-e2e-tests branch August 2, 2021 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants