Commit Graph

353 Commits

Author SHA1 Message Date
Ahmed AbouZaid
1b1e6ccab0 Test transformers krm exec function 2022-10-22 03:16:41 +02:00
Kubernetes Prow Robot
bf7a0f9004 Merge pull request #4805 from aibarbetta/fix-4717
[address #4717] Re-do create template/metadata when using includeTemplates if not present
2022-10-11 09:23:02 -07:00
Agustina Barbetta
7b84613ad1 Use fewer labels to ease reading 2022-10-08 20:38:44 -03:00
Agustina Barbetta
acba8fff62 Update api/krusty/inlinelabels_test.go
Co-authored-by: Katrina Verey <kn.verey@gmail.com>
2022-10-08 20:18:57 -03:00
Kubernetes Prow Robot
9ef7ba9c95 Merge pull request #4663 from johnmanjiro13/handle-error-of-remove-annotation
fix: handle error of remove annotations
2022-10-07 08:19:53 -07:00
johnmanjiro13
4e7f4bce7b feat: Wrap error 2022-10-07 18:14:59 +09:00
Agustina Barbetta
344b257c1f add tests for other kinds 2022-09-23 15:54:25 -03:00
yugo kobayashi
401cf9579c update golangci-lint v1.49.0 2022-09-22 13:24:40 +00:00
Agustina Barbetta
662ccf1915 add test for resources with no template 2022-09-20 13:29:38 -03:00
Yunchi Luo
e62480d11c Rewrite remoteload_test integration tests (#4783)
* Better error message when git clone fails

* support file:// URLs

* rewrite remoteload_test

* lint and test fix

* fixes for kverey's comments

* document file:// remote load

* replace assert with require where appropriate

* add tests for file:// without git suffix

* fixes plus pr review from natasha

* fixes for review, lint

* revert changes to error handling

* fix skipped test
2022-09-19 09:13:18 -07:00
Anna Song
eb51117adf Fix flaky
Disable submodules and increase timeout to prevent `localize` test that uses testdata from flaking.
2022-09-15 18:05:25 -07:00
johnmanjiro13
a8c0be49ae fix: handle error of remove annotations 2022-09-05 16:27:59 +09:00
yugo kobayashi
a54226e0a9 fix error handling 2022-09-03 00:29:10 +00:00
Natasha Sarkar
8868d91670 Revert "Load and calculate Destination of files for kustomize localize (#4652)"
This reverts commit bf17fe1d8f.
2022-08-26 13:26:23 -05:00
Kubernetes Prow Robot
b6fae2a959 Merge pull request #4759 from mightyguava/enable-ssh-tests
Enable SSH tests
2022-08-26 09:14:25 -07:00
natasha41575
08918ea352 run openapi tests with other krusty tests 2022-08-26 09:01:44 -05:00
Yunchi Luo
5dcbd35e40 Enable SSH tests 2022-08-25 16:57:21 -04:00
Anna Song
bf17fe1d8f Load and calculate Destination of files for kustomize localize (#4652)
* Implement file localization for localize

Implement file localization for new command kustomize localize

* Patch file localization

Fix lint errors, address feedback, begin transition to file loader from
localizer

* Add Repo() to Loader

* Implement locLoader factory + cleanup

* Add domain to RepoSpec

Fix ssh relative url host parsing for non-github domain on the side

* Implement Load(), New(), Root(), Dst() for LocLoader

* Address repospec code review comments

* Address 1st round of code review feedback

* Address feedback #2

Removed localized path calculations to cover edge case and improve readability.

* Remove ldr Cleanup logging

* Address code review round #3

* Address code review feedback #4
2022-08-19 14:33:53 -07:00
Katrina Verey
f6b72077c8 Stop using deprecated ioutil functions 2022-08-10 18:22:46 -04:00
Katrina Verey
5762794793 Revert "[address #4717] create template/metadata when using includeTemplates if not present" 2022-08-10 14:06:33 -04:00
Agustina Barbetta
15545cc228 create template/metadata in includeTemplates if not present 2022-08-07 20:48:51 -03:00
Natasha Sarkar
1b0fe2a078 update openapi scripts to fetch protobuffer schemas (#4582)
* update openapi scripts to fetch protobuffer schema

* code review

* code review

* restore makeOpenApiInfoDotGo.sh

* code review
2022-08-05 15:00:32 -07:00
Kubernetes Prow Robot
0fce7d53a9 Merge pull request #4703 from KnVerey/name-ref-annotations
Fix NameReference transformer handling of self-references in annotations
2022-07-11 17:22:50 -07:00
Katrina Verey
68780b4c0c Fix flakey test 2022-07-11 20:03:13 -04:00
Katrina Verey
04e1663b70 appendCsVAnnotation must mutate the annotations RNode in place
Otherwise, it is incompatible with filters like fieldSpec.Filter that recurse through a tree of RNodes. In the case of the bug this commit fixes, the leaf RNode is a metadata.annotation value field, and appendCsvAnnotation is called immediately before updating that leaf's value. If appendCsvAnnotation replaces the entire metadata.annotation RNode on the resource, the leaf RNode that gets updated is no longer attached to the resource.

Alternatively, `func (f Filter) setScalar` could be updated to change
the value of the leaf RNode BEFORE calling appendCsvAnnotation. However,
the modification of the entire metadata segment of the RNode in a
function that nominally just edits an annotation feels like a
side-effect prone to creating other difficult-to-debug situations,
beyond this ordering dependency.
2022-07-11 19:58:49 -04:00
Katrina Verey
77814ac12b NameReferenceTransformer misses self references in annotations 2022-07-08 22:07:15 -04:00
Kubernetes Prow Robot
344d0eec83 Merge pull request #4700 from KnVerey/ns_transformer_err_on_ambiguous_ns
Correctly detect ambiguity between potential referrers when targeting a name+namespace reference
2022-07-07 15:48:37 -07:00
Katrina Verey
387c95be1f Correctly detect ambiguity between potential referrers when targeting a name+namespace reference 2022-07-07 18:33:48 -04:00
Kubernetes Prow Robot
8a729459aa Merge pull request #4694 from annasong20/add-loc-tdata-remote
Add `localize` test data with remote reference
2022-06-30 14:22:44 -07:00
Anna Song
d1102fb726 Move demandDirectoryRoot into kyaml/filesys (#4677)
* Move demandDirectoryRoot into kyaml/filesys

* Make root directory platform-agnostic

Support windows root directory. Dogfood own error package.

* Use cleaner windows support implementation

* Address feedback

* Address feedback x2

* Re-apply go.sum changes to avoid CI errors
2022-06-30 11:12:07 -07:00
Anna Song
edb6294741 Add kustomization with remote reference 2022-06-30 17:21:23 +00:00
Nuno Anselmo
d8efc15169 Adds commentary on expected/unexpected test output 2022-06-21 23:52:39 +01:00
Nuno Anselmo
86d48b2a95 Implements TestNamedspacedServiceAccounts with and without overlap 2022-06-21 23:07:54 +01:00
Anna Song
3fdf88d10e Allow tests to only run locally (#4664)
* Allow tests to only run locally

Allow tests that are flaky or currently unsupported on the server to run locally

* Address feedback
2022-06-08 10:04:23 -07:00
Anna Song
a37572d193 Skip more flaky tests 2022-05-12 16:23:42 -07:00
Kubernetes Prow Robot
596519d3f2 Merge pull request #4631 from annasong20/localize-test
Add test directory for command localize
2022-05-10 11:13:43 -07:00
Kubernetes Prow Robot
d3d92157fa Merge pull request #4567 from mvgmb/master
Add support for remote OpenAPI schema
2022-05-10 11:01:43 -07:00
Anna Song
c83ebd9530 Add test directory for command localize
Create simple kustomization directory that `kustomize localize` can download as remote reference in test.
2022-05-10 10:58:33 -07:00
Anna Song
b8d2ff2afa Fix TODO comment syntax 2022-05-06 09:24:23 -07:00
Anna Song
7e0158e1e9 Skip flaky tests
Skip tests that behave reliably locally, but are flaky on macOS server.
2022-05-06 08:12:39 -07:00
Agustina Barbetta
5948f6aa63 [Address #3937] Add labels to template/metadata if includeTemplates is true (#4209)
* add labels in template/metadata by default

* update comment

* fix kustomization labels test

* Add spec/template/metadata/labels when includeTemplate is true

* remove unnecessary test changes

* add error wrap

* Revert "add error wrap"

This reverts commit 0a203df83edb90a400b35d5521487b984619e919.

* add error wrap at template fieldSpec merge
2022-05-05 11:24:22 -07:00
Anna Song
17b42a99f5 Skip ssh tests
Skip ssh tests and correct error msg that's different on server.
2022-05-05 09:26:44 -07:00
Anna Song
271f393218 Address feedback
Change asserts to, on fail, fail tests. Address feedback on previous commit. Enable ssh to check if server has ssh keys.
2022-05-04 18:54:12 -07:00
Anna Song
c0dc68d6e7 Add url tests
Write comprehensive suite of integration tests for remote resources, as specified by Issue #4588
2022-05-03 13:53:03 -07:00
Mário Bezerra
d49e5aa5aa Add tests for remote OpenAPI schema 2022-04-20 00:03:22 -03:00
Mário Bezerra
94af647556 Add support for remote OpenAPI schema 2022-04-19 23:58:04 -03:00
Natasha Sarkar
9d5491c2e2 fix containerized function mounts issue (#4489)
* fix containerized function mounts issue

* skip path test on windows

* move test out of temp dir

* update tests to deal with new working dir restrictions

* code review
2022-04-18 14:25:50 -07:00
Natasha Sarkar
cf89eae804 openapi parsing performance improvement with protobuffer (#4568)
* update necessary dependencies

* update openapi test structure

* remove old swagger files and generate new ones

* use protobuffer to parse openapi for performance improvement
2022-04-18 11:10:43 -07:00
Eng Zer Jun
9452a031ba test: use T.TempDir to create temporary test directory (#4587)
* 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>

* test: fix `TestInit_noargs` on Windows

--- FAIL: TestInit_noargs (0.01s)
    testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestInit_noargs3136084632\001: The process cannot access the file because it is being used by another process.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix `TestTreeCommandDefaultCurDir_files` on Windows

--- FAIL: TestTreeCommandDefaultCurDir_files (0.01s)
    testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestTreeCommandDefaultCurDir_files716679291\001: The process cannot access the file because it is being used by another process.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix `TestCreateSetterCommand` on Windows

--- FAIL: TestCreateSetterCommand (13.27s)
    --- FAIL: TestCreateSetterCommand/add_replicas (1.45s)
        testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestCreateSetterCommandadd_replicas176222064\001\k8s-cli-487197005.yaml: The process cannot access the file because it is being used by another process.
    ...
    and all subtests
    ...

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix `TestCreateSubstitutionCommand` on Windows

--- FAIL: TestCreateSubstitutionCommand (4.16s)
    --- FAIL: TestCreateSubstitutionCommand/substitution_replicas (1.30s)
        testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestCreateSubstitutionCommandsubstitution_replicas1352417113\001\k8s-cli-3183612276.yaml: The process cannot access the file because it is being used by another process.
    ...
    and all subtests
    ...

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix `TestDeleteSetterCommand` on Windows

--- FAIL: TestDeleteSetterCommand (4.36s)
    --- FAIL: TestDeleteSetterCommand/delete_replicas (1.31s)
        testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestDeleteSetterCommanddelete_replicas3949811929\001\k8s-cli-957077271.yaml: The process cannot access the file because it is being used by another process.
    ...
    and all subtests
    ...

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix `TestDeleteSubstitutionCommand` on Windows

--- FAIL: TestDeleteSubstitutionCommand (2.35s)
    --- FAIL: TestDeleteSubstitutionCommand/delete_only_subst_if_setter_has_same_name_-_long_ref (1.15s)
        testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestDeleteSubstitutionCommanddelete_only_subst_if_setter_has_same_name_-_long_ref2039728641\001\k8s-cli-1602861478.yaml: The process cannot access the file because it is being used by another process.
    ...
    and all subtests
    ...

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* test: fix `TestSetCommand` on Windows

--- FAIL: TestSetCommand (13.76s)
    --- FAIL: TestSetCommand/set_replicas (1.13s)
        testing.go:1090: TempDir RemoveAll cleanup: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestSetCommandset_replicas3781384539\001\k8s-cli-1030344459.yaml: The process cannot access the file because it is being used by another process.
    ...
    and all subtests
    ...

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-04-18 09:32:41 -07:00
Katrina Verey
0fa010c7e7 Add missing boilerplate 2022-04-04 14:24:04 -04:00