Commit Graph

8 Commits

Author SHA1 Message Date
Eng Zer Jun 736c7c24ef
test: use `T.TempDir` to create temporary test directory (#1660)
* test: use `T.TempDir` to create temporary test directory

This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* docs: update CHANGELOG.adoc

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-04-21 11:53:30 +00:00
Gunjan Vyas ad863f3f37
Added eventtype support (#1598)
* Added eventtype list and eventingv1beta1 client to Knparams

* Add kn eventtype describe command

* Added eventtype builder and create command

* Added eventtype delete command

* Added autocomplete for eventtype commands

* Added mock client and create tests

* Added delete tests

* Added describe tests

* Added tests for list

* Added flag test

* Added mock client tests

* Added completion helper tests

* Added client tests

* Added types test

* Added e2e tests

* Removed non-essential list columns and renamed imports

* Update pkg/kn/commands/eventtype/list.go

Co-authored-by: David Simansky <dsimansk@redhat.com>

Co-authored-by: David Simansky <dsimansk@redhat.com>
2022-03-02 03:48:43 -08:00
Gunjan Vyas a1079df154
Adding completion for remaining Eventing resources (#1567)
* Added completion for trigger

* Added tests for trigger

* Added container sources completion

* Added tests for container source completion

* Add completion helper for apiserver sources

* Added tests for apiserver sources

* Added completion for binding sources

* Added tests for sink binding completion

* Added completion for ping source

* Added tests for ping source completion

* Added completion for channel

* Added completion for subscription

* Added tests for channels

* Added tests for subscription completion

* Kn params initialization fix and resource name fix in tests
2022-01-18 01:08:32 -08:00
Gunjan Vyas d8670f5762
Added completion for domain command (#1562)
* Added completion for domain command

* Added tests for domain completion
2022-01-12 06:19:51 -08:00
Gunjan Vyas 07d0cd75c7
Added completion for route name (#1561)
* Added completion for route

* Added tests for route completion
2022-01-10 10:12:59 -08:00
Gunjan Vyas c5dfb08f81
Added completion for revision resource (#1560)
* Added completion for revision resource

* Added unit tests for revision autocompletion

* Fixed merge conflicts
2022-01-10 06:58:59 -08:00
Gunjan Vyas c6997da944
Added autocompletion for broker (#1559)
* Added autocompletion for broker

* Added broker completion tests

* Renamed imports
2022-01-10 04:33:59 -08:00
Gunjan Vyas 63142983ac
Added autocompletion for service name (#1547)
* Added autocompletion for service name

* Added unit tests

* Added error handling for panic if no namespace flag added to command

* Removed target field from config

* Modified signature for completion functions
2022-01-04 04:31:33 -08:00