Skip to content

Port kustomize tests#36

Merged
andyyu2004 merged 33 commits intomasterfrom
port-kustomize-tests
Feb 9, 2026
Merged

Port kustomize tests#36
andyyu2004 merged 33 commits intomasterfrom
port-kustomize-tests

Conversation

@andyyu2004
Copy link
Owner

No description provided.

Ported from kustomize/kyaml/yaml/rnode_test.go:
1. TestRNode_GetMeta_UTF16 (line 657) - Tests metadata extraction from YAML
   with UTF-16 characters in comments
2. TestDeAnchor (line 699) - Tests YAML anchor/alias resolution
3. TestDeAnchorMerge (line 724) - Tests YAML merge keys with anchors
4. TestRNode_UnmarshalJSON (line 1174) - Tests JSON resource input

All tests pass successfully.
…de-map

Ported from kustomize/kyaml/yaml/rnode_test.go:
- TestRNodeGetValidatedMetadata (line 363)
- TestRNodeMapEmpty (line 490)
- TestRNodeMap (line 496)

These tests verify:
1. Metadata validation and extraction from resources
2. Empty resource handling
3. Resource to map conversion

All tests passing.
Tests that empty patch files (truly empty, comments-only, or whitespace-only)
are properly ignored when using the patches field with explicit targets.

Test: empty-patch-files-ignored
Tests ported from kustomize/api/krusty/extendedpatch_test.go:
- TestExtendedPatchLabelSelector
- TestExtendedPatchNameGvkLabelSelector
- TestExtendedPatchMultiplePatchOverlapping
- TestExtendedPatchWithoutTarget

All tests pass successfully with kustomizer.
Test ported from kustomize/api/krusty/extendedpatch_test.go:
- TestExtendedPatchNameGvkSelector

Test passes successfully with kustomizer.
Test ported from kustomize/api/krusty/extendedpatch_test.go:
- TestExtendedPatchGvkSelector

Test passes successfully with kustomizer.
This test verifies that kustomize applies default legacy sort ordering when
sortOptions is not specified in the kustomization.yaml file.
Added tests:
- simple-base: Tests basic namePrefix, commonLabels, and commonAnnotations on Service, Deployment, and NetworkPolicy
- base-with-generators-alone: Tests generators with configMapGenerator and secretGenerator
- generating-into-namespaces: Tests generating ConfigMaps and Secrets into specific namespaces

Source: kustomize/api/krusty/generatormergeandreplace_test.go
Ported from kustomize/api/krusty/namereference_test.go:

1. TestIssue3489 - Complex external-dns scenario with multiple overlays
   Tests that name references (serviceAccountName, secret names) are correctly
   updated per variant when same base is used with different transformations

2. TestBackReferenceAdmissionPolicy - ValidatingAdmissionPolicyBinding references
   Tests that ValidatingAdmissionPolicyBinding correctly references
   ValidatingAdmissionPolicy when name transformations are applied

Both tests pass successfully.
Ported from kustomize/api/krusty/diamondcomposition_test.go:
- TestIssue1251_CompositeDiamond_Failure
- TestIssue1251_Patches_ProdVsDev_Failure
- TestIssue1251_Patches_ProdVsDev (prod scenario)

These tests cover diamond composition patterns and load restrictor behavior.
Ported from kustomize/api/krusty/diamondcomposition_test.go:
- TestIssue1251_Patches_ProdVsDev (dev scenario)
- TestIssue1251_Plugins_ProdVsDev (prod scenario)
- TestIssue1251_Plugins_ProdVsDev (dev scenario)

These tests use JSON patches (converted from PatchJson6902Transformer format).
Ported from kustomize/api/krusty/diamondcomposition_test.go:
- TestIssue1251_Plugins_Local
- TestIssue1251_Plugins_Bundled

These tests use JSON patches (converted from PatchJson6902Transformer format).
All tests use inline patches or local patch files in the modern format.
Ported tests:
- TestTargetMustHaveKustomizationFile
- TestTargetMustHaveOnlyOneKustomizationFile
- TestBaseMustHaveKustomizationFile
- TestResourceNotFound
- TestResourceHasAnchor

Source: kustomize/api/krusty/accumulation_test.go
This test verifies that malformed YAML files generate appropriate
error messages during resource accumulation.

Source: kustomize/api/krusty/accumulation_test.go::TestAccumulateResourcesErrors
Add tests for:
- extended-patch-inline-json: Extended patches field with inline JSON patch
- extended-patch-inline-yaml: Extended patches field with inline YAML patch
- patch-with-cronjob-v1: Patch with CronJob v1 resource

Ported from kustomize/api/krusty/inlinepatch_test.go
- TestGeneratorOverlays: Complex multi-layer ConfigMap generator overlays
- TestDataEndsWithQuotes: Regression test for issue #4233 - data ending with quotes
- TestDataIsSingleQuote: ConfigMap with data value that is a single quote
- TestPrefixSuffix: Regression test for issue #5047 - ConfigMap with dash prefix and suffix
- TestPrefixSuffix2: Regression test for issue #5047 - ConfigMap with dash prefix (variant 2)
- TestIssue3393: Merging configMapGenerator with existing ConfigMap resource
- TestGeneratorOverlaysBinaryData: ConfigMap overlay with binary data file
ConfigMap and Secret generation from files, envs, env, and literals
Added 2 tests from kustomize/api/krusty/complexcomposition_test.go:
- TestComplexComposition_Dev_Failure: Tests that combining storage
  and config overlays fails with already registered id error
- TestComplexComposition_Prod_Failure: Tests that combining config,
  tolerations, and https overlays fails with already registered id error

These tests verify that kustomizer properly detects duplicate resource
errors when multiple overlays include the same base resource.
Added the remaining two tests from iampolicygenerator_test.go:
- gke-generator-with-namespace (TestGkeGeneratorWithNamespace)
- gke-generator-with-two (TestGkeGeneratorWithTwo)

All three tests fail because kustomizer does not support the IAMPolicyGenerator
builtin plugin, which is used to create ServiceAccounts with cloud provider IAM
annotations for workload identity.
Added tests for:
- TestBase: Tests basic namePrefix/nameSuffix application
- TestMidLevelA: Tests overlay with additional prefix/suffix on base
- TestMidLevelB: Tests overlay with different prefix/suffix on base

Source: kustomize/api/krusty/resourceconflict_test.go
Tests that combining multiple overlays (A and B) that each reference the same
base with different prefixes/suffixes produces distinct resources without conflicts.

Source: kustomize/api/krusty/resourceconflict_test.go::TestMultibasesNoConflict
This test verifies that CRD resources can be processed as regular
resources without requiring the 'crds' field. The test ensures that
a CustomResourceDefinition with a 'containers' field in its schema
is properly handled and output.

Test passes successfully.
Tests secretGenerator with literals, files, and envs options.
Creates secret with multiple data sources:
- literals (FRUIT, VEGETABLE)
- files (foo.env, passphrase from phrase.dat)
- envs (foo.env environment variables)

Source: kustomize/api/krusty/generatoroptions_test.go
Test: TestSecretGenerator
Tests added:
- issue-2896-base: Tests base kustomization with nameSuffix applied to deployment
- issue-2896-overlay: Tests overlay applying strategic merge patch to change container image while preserving nameSuffix transformation
Ported from kustomize/api/krusty/validatingwebhook_test.go
TestValidatingWebhookCombinedNamespaces. Tests that validating webhook
configurations are correctly handled when combining namespaces with
patch deletion (issue #3732).
Ported from kustomize/api/krusty/customconfigreusable_test.go
TestReusableCustomTransformers. This test demonstrates custom
transformer configurations as reusable resources.
Ported from kustomize/api/krusty/legacy_order_test.go - "TestIssue4388"

Tests that resources from a multi-document YAML file maintain their order.
These tests belong on their respective bug branches:
- gke-generator tests -> bug/gke-generator
- list tests -> bug/list-to-individual-resources, bug/empty-list
- transformers-image-default-config -> bug/transformers-image-default-config
…ea that they're reporting the error for the same reason
@andyyu2004 andyyu2004 enabled auto-merge (squash) February 9, 2026 09:47
@andyyu2004 andyyu2004 disabled auto-merge February 9, 2026 09:47
@andyyu2004 andyyu2004 enabled auto-merge (squash) February 9, 2026 09:48
@andyyu2004 andyyu2004 merged commit 08bd23d into master Feb 9, 2026
1 check passed
@andyyu2004 andyyu2004 deleted the port-kustomize-tests branch February 9, 2026 09:49
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.

1 participant

Comments