{"modulePath":"github.com/khulnasoft/codeinfra/pkg/v3","version":"v3.0.0-20250113030722-a5432f4f7697","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package test\n\n## Constants\n\n```go\nconst (\n\tTestDotnet = \"dotnet\"\n\tTestGo     = \"go\"\n\tTestNodeJS = \"nodejs\"\n\tTestPython = \"python\"\n)\n```\n\n```go\nconst CodeinfraDotnetSDKVersion = \"3.71.1\"\n```\nCodeinfraDotnetSDKVersion is the version of the Codeinfra .NET SDK to use in program-gen tests\n\n## Variables\n\n```go\nvar CodeinfraCodeinfraProgramTests = []ProgramTest{\n\t{\n\t\tDirectory:   \"assets-archives\",\n\t\tDescription: \"Assets and archives\",\n\t},\n\t{\n\t\tDirectory:   \"synthetic-resource-properties\",\n\t\tDescription: \"Synthetic resource properties\",\n\t\tSkipCompile: codegen.NewStringSet(TestNodeJS, TestDotnet, TestGo),\n\t},\n\t{\n\t\tDirectory:   \"aws-s3-folder\",\n\t\tDescription: \"AWS S3 Folder\",\n\t\tSkipCompile: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"aws-eks\",\n\t\tDescription: \"AWS EKS\",\n\t},\n\t{\n\t\tDirectory:   \"csharp-invoke-options\",\n\t\tDescription: \"A program that uses InvokeOptions in C#\",\n\n\t\tSkip: allProgLanguages.Except(TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"aws-fargate\",\n\t\tDescription: \"AWS Fargate\",\n\t},\n\t{\n\t\tDirectory:   \"aws-static-website\",\n\t\tDescription: \"an example resource from AWS static website multi-language component\",\n\n\t\tSkipCompile: codegen.NewStringSet(TestDotnet, TestPython),\n\t},\n\t{\n\t\tDirectory:   \"aws-fargate-output-versioned\",\n\t\tDescription: \"AWS Fargate Using Output-versioned invokes for python and typescript\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestDotnet),\n\t\tBindOptions: []pcl.BindOption{pcl.PreferOutputVersionedInvokes},\n\t},\n\t{\n\t\tDirectory:   \"aws-s3-logging\",\n\t\tDescription: \"AWS S3 with logging\",\n\t\tSkipCompile: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"aws-iam-policy\",\n\t\tDescription: \"AWS IAM Policy\",\n\t},\n\t{\n\t\tDirectory:   \"read-file-func\",\n\t\tDescription: \"ReadFile function translation works\",\n\t},\n\t{\n\t\tDirectory:   \"python-regress-10914\",\n\t\tDescription: \"Python regression test for #10914\",\n\t\tSkip:        allProgLanguages.Except(TestPython),\n\t},\n\t{\n\t\tDirectory:   \"simplified-invokes\",\n\t\tDescription: \"Simplified invokes\",\n\t\tSkip:        codegen.NewStringSet(TestPython, TestGo),\n\t\tSkipCompile: codegen.NewStringSet(TestDotnet, TestNodeJS),\n\t},\n\t{\n\t\tDirectory:   \"aws-optionals\",\n\t\tDescription: \"AWS get invoke with nested object constructor that takes an optional string\",\n\n\t\tSkip: allProgLanguages.Except(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"aws-webserver\",\n\t\tDescription: \"AWS Webserver\",\n\t},\n\t{\n\t\tDirectory:   \"simple-range\",\n\t\tDescription: \"Simple range as int expression translation\",\n\t},\n\t{\n\t\tDirectory:   \"azure-native\",\n\t\tDescription: \"Azure Native\",\n\t\tSkipCompile: codegen.NewStringSet(TestGo, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"azure-native-v2-eventgrid\",\n\t\tDescription: \"Azure Native V2 basic example to ensure that importPathPatten works\",\n\n\t\tPluginHost: utils.NewHostWithProviders(testdataPath,\n\t\t\tutils.NewSchemaProvider(\"azure-native\", \"2.41.0\")),\n\t},\n\t{\n\t\tDirectory:   \"azure-sa\",\n\t\tDescription: \"Azure SA\",\n\t},\n\t{\n\t\tDirectory:   \"string-enum-union-list\",\n\t\tDescription: \"Contains resource which has a property of type List\u003cUnion\u003cString, Enum\u003e\u003e\",\n\n\t\tSkipCompile: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"using-object-as-input-for-any\",\n\t\tDescription: \"Tests using object as input for a property of type 'any'\",\n\t},\n\t{\n\t\tDirectory:   \"kubernetes-operator\",\n\t\tDescription: \"K8s Operator\",\n\t},\n\t{\n\t\tDirectory:   \"kubernetes-pod\",\n\t\tDescription: \"K8s Pod\",\n\t\tSkipCompile: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"kubernetes-template\",\n\t\tDescription: \"K8s Template\",\n\t},\n\t{\n\t\tDirectory:   \"kubernetes-template-quoted\",\n\t\tDescription: \"K8s Template with quoted string property keys to ensure that resource binding works here\",\n\t},\n\t{\n\t\tDirectory:   \"random-pet\",\n\t\tDescription: \"Random Pet\",\n\t},\n\t{\n\t\tDirectory:   \"aws-secret\",\n\t\tDescription: \"Secret\",\n\t},\n\t{\n\t\tDirectory:   \"functions\",\n\t\tDescription: \"Functions\",\n\t},\n\t{\n\t\tDirectory:   \"output-funcs-aws\",\n\t\tDescription: \"Output Versioned Functions\",\n\t},\n\t{\n\t\tDirectory:   \"third-party-package\",\n\t\tDescription: \"Ensuring correct imports for third party packages\",\n\n\t\tSkipCompile: codegen.NewStringSet(TestNodeJS, TestDotnet, TestGo),\n\t},\n\t{\n\t\tDirectory:   \"invalid-go-sprintf\",\n\t\tDescription: \"Regress invalid Go\",\n\t\tSkip:        codegen.NewStringSet(TestPython, TestNodeJS, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"typed-enum\",\n\t\tDescription: \"Supply strongly typed enums\",\n\t\tSkip:        codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"codeinfra-stack-reference\",\n\t\tDescription: \"StackReference as resource\",\n\t},\n\t{\n\t\tDirectory:   \"python-resource-names\",\n\t\tDescription: \"Repro for #9357\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"logical-name\",\n\t\tDescription: \"Logical names\",\n\t},\n\t{\n\t\tDirectory:   \"aws-lambda\",\n\t\tDescription: \"AWS Lambdas\",\n\n\t\tSkip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"basic-unions\",\n\t\tDescription: \"Tests program generation of fields of type union\",\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"deferred-outputs\",\n\t\tDescription: \"Tests program with mutually dependant components that emit deferred outputs\",\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"traverse-union-repro\",\n\t\tDescription: `Handling the error \"cannot traverse value of type union(...)\"`,\n\t\tBindOptions: []pcl.BindOption{\n\t\t\tpcl.SkipResourceTypechecking,\n\t\t\tpcl.AllowMissingVariables,\n\t\t\tpcl.AllowMissingProperties,\n\t\t},\n\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"components\",\n\t\tDescription: \"Components\",\n\t\tSkipCompile: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"entries-function\",\n\t\tDescription: \"Using the entries function\",\n\n\t\tSkipCompile: allProgLanguages.Except(TestNodeJS).Except(TestPython),\n\t},\n\t{\n\t\tDirectory:   \"retain-on-delete\",\n\t\tDescription: \"Generate RetainOnDelete option\",\n\t},\n\t{\n\t\tDirectory:   \"depends-on-array\",\n\t\tDescription: \"Using DependsOn resource option with an array of resources\",\n\t},\n\t{\n\t\tDirectory:   \"multiline-string\",\n\t\tDescription: \"Multiline string literals\",\n\t},\n\t{\n\t\tDirectory:   \"config-variables\",\n\t\tDescription: \"Basic program with a bunch of config variables\",\n\n\t\tSkipCompile: codegen.NewStringSet(TestGo, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"regress-11176\",\n\t\tDescription: \"Regression test for https://github.com/khulnasoft/codeinfra/issues/11176\",\n\t\tSkip:        allProgLanguages.Except(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"throw-not-implemented\",\n\t\tDescription: \"Function notImplemented is compiled to a runtime error at call-site\",\n\t},\n\t{\n\t\tDirectory:   \"python-reserved\",\n\t\tDescription: \"Test python reserved words aren't used\",\n\t\tSkip:        allProgLanguages.Except(TestPython),\n\t},\n\t{\n\t\tDirectory:   \"iterating-optional-range-expressions\",\n\t\tDescription: \"Test that we can iterate over range expression that are option(iterator)\",\n\n\t\tSkip: allProgLanguages.Except(TestNodeJS).Except(TestPython),\n\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"output-literals\",\n\t\tDescription: \"Tests that we can return various literal values via stack outputs\",\n\t},\n\t{\n\t\tDirectory:   \"dynamic-entries\",\n\t\tDescription: \"Testing iteration of dynamic entries in TypeScript\",\n\t\tSkip:        allProgLanguages.Except(TestNodeJS),\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"single-or-none\",\n\t\tDescription: \"Tests using the singleOrNone function\",\n\t},\n\t{\n\t\tDirectory:   \"simple-splat\",\n\t\tDescription: \"An example that shows we can compile splat expressions from array of objects\",\n\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"invoke-inside-conditional-range\",\n\t\tDescription: \"Using the result of an invoke inside a conditional range expression of a resource\",\n\t\tSkip:        allProgLanguages.Except(TestNodeJS).Except(TestDotnet),\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"output-name-conflict\",\n\t\tDescription: \"Tests whether we are able to generate programs where output variables have same id as config var\",\n\t\tSkipCompile: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"snowflake-python-12998\",\n\t\tDescription: \"Tests regression for issue https://github.com/khulnasoft/codeinfra/issues/12998\",\n\t\tSkip:        allProgLanguages.Except(TestPython),\n\t\tSkipCompile: allProgLanguages,\n\t\tBindOptions: []pcl.BindOption{pcl.AllowMissingVariables, pcl.AllowMissingProperties},\n\t},\n\t{\n\t\tDirectory:   \"unknown-resource\",\n\t\tDescription: \"Tests generating code for unknown resources when skipping resource type-checking\",\n\t\tSkipCompile: allProgLanguages,\n\t\tBindOptions: []pcl.BindOption{pcl.SkipResourceTypechecking},\n\t},\n\t{\n\t\tDirectory:   \"using-dashes\",\n\t\tDescription: \"Test program generation on packages with a dash in the name\",\n\t\tSkipCompile: allProgLanguages,\n\t},\n\t{\n\t\tDirectory:   \"unknown-invoke\",\n\t\tDescription: \"Tests generating code for unknown invokes when skipping invoke type checking\",\n\t\tSkipCompile: allProgLanguages,\n\t\tBindOptions: []pcl.BindOption{pcl.SkipInvokeTypechecking},\n\t},\n\t{\n\t\tDirectory:   \"optional-complex-config\",\n\t\tDescription: \"Tests generating code for optional and complex config values\",\n\t\tSkip:        allProgLanguages.Except(TestNodeJS).Except(TestDotnet),\n\t\tSkipCompile: allProgLanguages.Except(TestNodeJS).Except(TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"interpolated-string-keys\",\n\t\tDescription: \"Tests that interpolated string keys are supported in maps. \",\n\t\tSkip:        allProgLanguages.Except(TestNodeJS).Except(TestPython),\n\t},\n\t{\n\t\tDirectory:   \"regress-node-12507\",\n\t\tDescription: \"Regression test for https://github.com/khulnasoft/codeinfra/issues/12507\",\n\t\tSkip:        allProgLanguages.Except(TestNodeJS),\n\t\tBindOptions: []pcl.BindOption{pcl.PreferOutputVersionedInvokes},\n\t},\n\t{\n\t\tDirectory:   \"csharp-plain-lists\",\n\t\tDescription: \"Tests that plain lists are supported in C#\",\n\t\tSkip:        allProgLanguages.Except(TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"csharp-typed-for-expressions\",\n\t\tDescription: \"Testing for expressions with typed target expressions in csharp\",\n\t\tSkip:        allProgLanguages.Except(TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"empty-list-property\",\n\t\tDescription: \"Tests compiling empty list expressions of object properties\",\n\t},\n\t{\n\t\tDirectory:   \"python-regress-14037\",\n\t\tDescription: \"Regression test for rewriting qoutes in python\",\n\t\tSkip:        allProgLanguages.Except(TestPython),\n\t},\n\t{\n\t\tDirectory:   \"inline-invokes\",\n\t\tDescription: \"Tests whether using inline invoke expressions works\",\n\t\tSkipCompile: codegen.NewStringSet(TestGo),\n\t},\n}\n```\n\n```go\nvar CodeinfraCodeinfraSDKTests = []*SDKTest{\n\t{\n\t\tDirectory:   \"naming-collisions\",\n\t\tDescription: \"Schema with types that could potentially produce collisions.\",\n\t},\n\t{\n\t\tDirectory:   \"dash-named-schema\",\n\t\tDescription: \"Simple schema with a two part name (foo-bar)\",\n\t},\n\t{\n\t\tDirectory:        \"external-resource-schema\",\n\t\tDescription:      \"External resource schema\",\n\t\tSkipCompileCheck: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"nested-module\",\n\t\tDescription: \"Nested module\",\n\t},\n\t{\n\t\tDirectory:   \"simplified-invokes\",\n\t\tDescription: \"Simplified invokes\",\n\t\tSkip:        codegen.NewStringSet(\"python/any\", \"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"nested-module-thirdparty\",\n\t\tDescription: \"Third-party nested module\",\n\t},\n\t{\n\t\tDirectory:   \"plain-schema-gh6957\",\n\t\tDescription: \"Repro for #6957\",\n\t},\n\t{\n\t\tDirectory:   \"resource-args-python-case-insensitive\",\n\t\tDescription: \"Resource args with same named resource and type case insensitive\",\n\t},\n\t{\n\t\tDirectory:   \"resource-args-python\",\n\t\tDescription: \"Resource args with same named resource and type\",\n\t},\n\t{\n\t\tDirectory:   \"simple-enum-schema\",\n\t\tDescription: \"Simple schema with enum types\",\n\t},\n\t{\n\t\tDirectory:   \"simple-plain-schema\",\n\t\tDescription: \"Simple schema with plain properties\",\n\t},\n\t{\n\t\tDirectory:   \"simple-plain-schema-with-root-package\",\n\t\tDescription: \"Simple schema with root package set\",\n\t},\n\t{\n\t\tDirectory:   \"simple-schema-pyproject\",\n\t\tDescription: \"A simple schema that generates a pyproject.toml file\",\n\t\tSkip:        codegen.NewStringSet(\"go/any\", \"nodejs/any\", \"dotnet/any\"),\n\t},\n\t{\n\t\tDirectory:   \"simple-resource-schema\",\n\t\tDescription: \"Simple schema with local resource properties\",\n\t},\n\t{\n\t\tDirectory:   \"simple-resource-schema-custom-pypackage-name\",\n\t\tDescription: \"Simple schema with local resource properties and custom Python package name\",\n\t},\n\t{\n\t\tDirectory:        \"simple-methods-schema\",\n\t\tDescription:      \"Simple schema with methods\",\n\t\tSkipCompileCheck: codegen.NewStringSet(TestNodeJS, TestGo),\n\t},\n\t{\n\t\tDirectory:   \"simple-methods-schema-single-value-returns\",\n\t\tDescription: \"Simple schema with methods that return single values\",\n\t},\n\t{\n\t\tDirectory:   \"methods-return-plain-resource\",\n\t\tDescription: \"Test returning plain Resource objects from methods\",\n\t\tSkip:        codegen.NewStringSet(\"dotnet/any\"),\n\t},\n\t{\n\t\tDirectory:   \"simple-yaml-schema\",\n\t\tDescription: \"Simple schema encoded using YAML\",\n\t},\n\t{\n\t\tDirectory:   \"provider-config-schema\",\n\t\tDescription: \"Simple provider config schema\",\n\n\t\tSkipCompileCheck: codegen.NewStringSet(TestDotnet, TestGo),\n\t},\n\t{\n\t\tDirectory:   \"replace-on-change\",\n\t\tDescription: \"Simple use of replaceOnChange in schema\",\n\t},\n\t{\n\t\tDirectory:   \"simple-resource-with-aliases\",\n\t\tDescription: \"Simple schema with a resource that has aliases\",\n\t},\n\t{\n\t\tDirectory:        \"resource-property-overlap\",\n\t\tDescription:      \"A resource with the same name as its property\",\n\t\tSkipCompileCheck: codegen.NewStringSet(TestDotnet, TestNodeJS),\n\t},\n\t{\n\t\tDirectory:   \"hyphen-url\",\n\t\tDescription: \"A resource url with a hyphen in its path\",\n\t\tSkip:        codegen.NewStringSet(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"output-funcs\",\n\t\tDescription: \"Tests targeting the $fn_output helper code generation feature\",\n\t},\n\t{\n\t\tDirectory:        \"output-funcs-edgeorder\",\n\t\tDescription:      \"Regresses Node compilation issues on a subset of azure-native\",\n\t\tSkipCompileCheck: codegen.NewStringSet(TestGo, TestPython),\n\t\tSkip:             codegen.NewStringSet(\"nodejs/test\"),\n\t},\n\t{\n\t\tDirectory:        \"output-funcs-tfbridge20\",\n\t\tDescription:      \"Similar to output-funcs, but with compatibility: tfbridge20, to simulate codeinfra-aws use case\",\n\t\tSkipCompileCheck: codegen.NewStringSet(TestPython),\n\t},\n\t{\n\t\tDirectory:   \"cyclic-types\",\n\t\tDescription: \"Cyclic object types\",\n\t},\n\t{\n\t\tDirectory:   \"regress-node-8110\",\n\t\tDescription: \"Test the fix for codeinfra/codeinfra#8110 nodejs compilation error\",\n\t\tSkip:        codegen.NewStringSet(\"go/test\", \"dotnet/test\"),\n\t},\n\t{\n\t\tDirectory:   \"dashed-import-schema\",\n\t\tDescription: \"Ensure that we handle all valid go import paths\",\n\t\tSkip:        codegen.NewStringSet(\"go/test\", \"dotnet/test\"),\n\t},\n\t{\n\t\tDirectory:   \"plain-and-default\",\n\t\tDescription: \"Ensure that a resource with a plain default property works correctly\",\n\t},\n\t{\n\t\tDirectory:   \"plain-object-defaults\",\n\t\tDescription: \"Ensure that object defaults are generated (repro #8132)\",\n\t},\n\t{\n\t\tDirectory:   \"plain-object-disable-defaults\",\n\t\tDescription: \"Ensure that we can still compile safely when defaults are disabled\",\n\t},\n\t{\n\t\tDirectory:        \"regress-8403\",\n\t\tDescription:      \"Regress codeinfra/codeinfra#8403\",\n\t\tSkipCompileCheck: codegen.NewStringSet(TestPython),\n\t},\n\t{\n\t\tDirectory:   \"different-package-name-conflict\",\n\t\tDescription: \"different packages with the same resource\",\n\t\tSkip:        allLanguages,\n\t},\n\t{\n\t\tDirectory:   \"different-enum\",\n\t\tDescription: \"An enum in a different package namespace\",\n\t\tSkip:        codegen.NewStringSet(\"dotnet/compile\"),\n\t},\n\t{\n\t\tDirectory:   \"array-of-enum-map\",\n\t\tDescription: \"A schema with an array of maps where the values are enums. Issue codeinfra/codeinfra#14734\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"azure-native-nested-types\",\n\t\tDescription: \"Condensed example of nested collection types from Azure Native\",\n\t\tSkip:        codegen.NewStringSet(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"regress-go-8664\",\n\t\tDescription: \"Regress codeinfra/codeinfra#8664 affecting Go\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"regress-go-10527\",\n\t\tDescription: \"Regress codeinfra/codeinfra#10527 affecting Go\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"regress-go-12971\",\n\t\tDescription: \"Regress codeinfra/codeinfra#12971 affecting Go\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"regress-go-15478\",\n\t\tDescription: \"Regress codeinfra/codeinfra#15478 affecting Go ensuring SDK-gen doesn't panic\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\n\t\tSkipCompileCheck: codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   \"regress-py-12546\",\n\t\tDescription: \"Regress codeinfra/codeinfra#12546 affecting Python\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"using-shared-types-in-config\",\n\t\tDescription: \"Tests that shared types can be used in config.\",\n\t},\n\t{\n\t\tDirectory:   \"other-owned\",\n\t\tDescription: \"CSharp rootNamespaces\",\n\n\t\tSkip: allLanguages.Except(\"dotnet/any\").Except(\"docs/any\"),\n\t},\n\t{\n\t\tDirectory: \"external-node-compatibility\",\n\n\t\tDescription: \"Ensure external package compatibility modes are used when referencing external types\",\n\t\tSkip:        allLanguages.Except(\"nodejs/any\"),\n\t},\n\t{\n\t\tDirectory: \"external-go-import-aliases\",\n\n\t\tDescription: \"Ensure external import aliases are honored, and any local import aliases override them\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"external-python-same-module-name\",\n\t\tDescription: \"Ensure referencing external types/resources with the same module name are referenced correctly\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"enum-reference\",\n\t\tDescription: \"Ensure referencing external types/resources with referenced enums import correctly\",\n\t},\n\t{\n\t\tDirectory:   \"enum-reference-python\",\n\t\tDescription: \"Ensure referencing external types/resources with referenced enums import correctly in Python\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"external-enum\",\n\t\tDescription: \"Ensure we generate valid tokens for external enums\",\n\t\tSkip:        codegen.NewStringSet(\"dotnet/any\"),\n\t},\n\t{\n\t\tDirectory:   \"internal-dependencies-go\",\n\t\tDescription: \"Emit Go internal dependencies\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"go-overridden-internal-module-name\",\n\t\tDescription: \"Go SDK where the internal module name is overridden to be 'utilities'\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"go-plain-ref-repro\",\n\t\tDescription: \"Generate a resource that accepts a plain input type\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"go-nested-collections\",\n\t\tDescription: \"Generate a resource that outputs [][][]Foo\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory: \"functions-secrets\",\n\n\t\tDescription: \"functions that have properties that are secrets in the schema\",\n\t},\n\t{\n\t\tDirectory:        \"secrets\",\n\t\tDescription:      \"Generate a resource with secret properties\",\n\t\tSkipCompileCheck: codegen.NewStringSet(TestDotnet),\n\t},\n\t{\n\t\tDirectory:   \"regress-py-tfbridge-611\",\n\t\tDescription: \"Regresses codeinfra/codeinfra-terraform-bridge#611\",\n\t\tSkip:        allLanguages.Except(\"python/any\").Union(codegen.NewStringSet(\"python/test\", \"python/py_compile\")),\n\t},\n\t{\n\t\tDirectory:   \"hyphenated-symbols\",\n\t\tDescription: \"Test that types can have names with hyphens in them\",\n\t\tSkip:        allLanguages.Except(\"go/any\").Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"provider-type-schema\",\n\t\tDescription: \"A schema with a type called Provider schema\",\n\t},\n\t{\n\t\tDirectory:   \"embedded-crd-types\",\n\t\tDescription: \"A schema with CRD types with package names different from the main package\",\n\t\tSkip:        codegen.NewStringSet(\"dotnet/any\"),\n\t},\n\t{\n\t\tDirectory:   \"unions-inside-arrays\",\n\t\tDescription: \"A schema with a union type inside an array\",\n\t},\n\t{\n\t\tDirectory:   \"assets-and-archives\",\n\t\tDescription: \"A schema with assets and archives\",\n\t},\n\t{\n\t\tDirectory:   \"regress-py-14012\",\n\t\tDescription: \"Regresses https://github.com/khulnasoft/codeinfra/issues/14012\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"regress-py-14539\",\n\t\tDescription: \"Regresses https://github.com/khulnasoft/codeinfra/issues/14539\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"output-funcs-go-generics-only\",\n\t\tDescription: \"Tests targeting the $fn_output code generation feature, only for Go generics == generics-only\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"plain-and-default-go-generics-only\",\n\t\tDescription: \"resource with a plain default property works, only for Go generics == generics-only\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"secrets-go-generics-only\",\n\t\tDescription: \"Generate a resource with secret properties, only for Go generics == generics-only\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"simple-enum-schema-go-generics-only\",\n\t\tDescription: \"Simple schema with enum types, only for Go generics == generics-only\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"simple-plain-schema-go-generics-only\",\n\t\tDescription: \"Simple schema with plain properties, only for Go generics == generics-only\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"assets-and-archives-go-generics-only\",\n\t\tDescription: \"Testing generating a schema with assets and archives for go using generics-only\",\n\t\tSkip:        allLanguages.Except(\"go/any\"),\n\t},\n\t{\n\t\tDirectory:   \"urn-id-properties\",\n\t\tDescription: \"Testing urn and id properties in valid locations\",\n\t},\n\t{\n\t\tDirectory:   \"regress-py-12980\",\n\t\tDescription: \"Import resources across modules\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"unions-inline\",\n\t\tDescription: \"Testing the use of unions/oneOf in the schema inline with the property definition.\",\n\t},\n\t{\n\t\tDirectory:   \"legacy-names\",\n\t\tDescription: \"Testing the use of snake_case names and tokens.\",\n\t\tSkip:        codegen.NewStringSet(\"go/test\"),\n\t},\n\t{\n\t\tDirectory:   \"kubernetes20\",\n\t\tDescription: \"Testing the kubernetes20 compatibility mode.\",\n\t\tSkip:        codegen.NewStringSet(\"go/test\"),\n\t},\n\t{\n\t\tDirectory:   \"python-typed-dict-setuppy\",\n\t\tDescription: \"Testing TypedDict generation for inputs.\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"python-typed-dict-disabled-setuppy\",\n\t\tDescription: \"Do not generated TypedDict types for inputs.\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"python-typed-dict-pyproject\",\n\t\tDescription: \"Testing TypedDict generation for inputs.\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n\t{\n\t\tDirectory:   \"config-variables\",\n\t\tDescription: \"Testing config variables.\",\n\t},\n\t{\n\t\tDirectory:   \"overlay-supported-languages\",\n\t\tDescription: \"Testing restricting the languages an overlay supports.\",\n\t\tSkip:        allLanguages.Except(\"docs/any\"),\n\t},\n\t{\n\t\tDirectory: \"regress-py-17219\",\n\n\t\tDescription: \"Regress codeinfra/codeinfra#17219 affecting Python\",\n\t\tSkip:        allLanguages.Except(\"python/any\"),\n\t},\n}\n```\n\n```go\nvar CodeinfraCodeinfraYAMLProgramTests = []ProgramTest{\n\n\t{\n\t\tDirectory:   transpiled(\"aws-eks\"),\n\t\tDescription: \"AWS EKS\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"aws-static-website\"),\n\t\tDescription: \"AWS static website\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),\n\t\tBindOptions: []pcl.BindOption{pcl.SkipResourceTypechecking},\n\t},\n\t{\n\t\tDirectory:   transpiled(\"awsx-fargate\"),\n\t\tDescription: \"AWSx Fargate\",\n\t\tSkip:        codegen.NewStringSet(TestDotnet, TestNodeJS, TestGo),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"azure-app-service\"),\n\t\tDescription: \"Azure App Service\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"azure-container-apps\"),\n\t\tDescription: \"Azure Container Apps\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet, TestPython),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"azure-static-website\"),\n\t\tDescription: \"Azure static website\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet, TestPython),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"cue-eks\"),\n\t\tDescription: \"Cue EKS\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"cue-random\"),\n\t\tDescription: \"Cue random\",\n\t},\n\t{\n\t\tDirectory:   transpiled(\"getting-started\"),\n\t\tDescription: \"Getting started\",\n\t},\n\t{\n\t\tDirectory:   transpiled(\"kubernetes\"),\n\t\tDescription: \"Kubernetes\",\n\t\tSkip:        codegen.NewStringSet(TestGo),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"codeinfra-variable\"),\n\t\tDescription: \"Codeinfra variable\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"random\"),\n\t\tDescription: \"Random\",\n\t\tSkip:        codegen.NewStringSet(TestNodeJS),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"readme\"),\n\t\tDescription: \"README\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"stackreference-consumer\"),\n\t\tDescription: \"Stack reference consumer\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"stackreference-producer\"),\n\t\tDescription: \"Stack reference producer\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestDotnet),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"webserver-json\"),\n\t\tDescription: \"Webserver JSON\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestDotnet, TestPython),\n\t},\n\t{\n\t\tDirectory:   transpiled(\"webserver\"),\n\t\tDescription: \"Webserver\",\n\t\tSkip:        codegen.NewStringSet(TestGo, TestDotnet, TestPython),\n\t},\n}\n```\n\n## Functions\n\n```go\nfunc CheckAllFilesGenerated(t *testing.T, actual, expected map[string][]byte)\n```\nCheckAllFilesGenerated ensures that the set of expected and actual files generated are exactly equivalent.\n\n```go\nfunc CheckVersion(t *testing.T, dir, depFilePath string, expectedVersionMap map[string]PkgVersionInfo)\n```\nCheckVersion checks for an expected package version Todo: support checking multiple package expected versions\n\n```go\nfunc CompilePython(t *testing.T, codeDir string)\n```\nChecks generated code for syntax errors with \\`python -m compile\\`.\n\n```go\nfunc CopyExtraFiles(t *testing.T, dir, lang string)\n```\nUseful for populating code-generated destination \\`codeDir=$dir/$lang\\` with extra manually written files such as the unit test files. These files are copied from \\`$dir/$lang-extras\\` folder if present.\n\n```go\nfunc GenProjectCleanUp(t *testing.T, dir, depFilePath, outfilePath string)\n```\n\n```go\nfunc GenerateDotnetBatchTest(t *testing.T, rootDir string, genProgram GenProgram, testCases []ProgramTest)\n```\n\n```go\nfunc GenerateDotnetProgramTest(\n\tt *testing.T,\n\tgenProgram GenProgram,\n\tgenProject GenProject,\n)\n```\n\n```go\nfunc GenerateDotnetYAMLBatchTest(t *testing.T, rootDir string, genProgram GenProgram)\n```\n\n```go\nfunc GenerateGoBatchTest(\n\tt *testing.T,\n\trootDir string,\n\tgenProgram GenProgram,\n\ttestCases []ProgramTest,\n)\n```\n\n```go\nfunc GenerateGoProgramTest(\n\tt *testing.T,\n\trootDir string,\n\tgenProgram GenProgram,\n\tgenProject GenProject,\n)\n```\n\n```go\nfunc GenerateGoYAMLBatchTest(t *testing.T, rootDir string, genProgram GenProgram)\n```\n\n```go\nfunc GenerateNodeJSBatchTest(t *testing.T, rootDir string, genProgram GenProgram, testCases []ProgramTest)\n```\n\n```go\nfunc GenerateNodeJSProgramTest(\n\tt *testing.T,\n\tgenProgram GenProgram,\n\tgenProject GenProject,\n)\n```\n\n```go\nfunc GenerateNodeJSYAMLBatchTest(t *testing.T, rootDir string, genProgram GenProgram)\n```\n\n```go\nfunc GeneratePackageFilesFromSchema(schemaPath string, genPackageFunc GenPkgSignature) (map[string][]byte, error)\n```\nGeneratePackageFilesFromSchema loads a schema and generates files using the provided GeneratePackage function.\n\n```go\nfunc GenerateProgramBatchTest(language string) func(*testing.T, string, GenProgram, []ProgramTest)\n```\nGenerateProgramBatchTest returns a batch generator for the given language.\n\n```go\nfunc GeneratePythonBatchTest(t *testing.T, rootDir string, genProgram GenProgram, testCases []ProgramTest)\n```\n\n```go\nfunc GeneratePythonProgramTest(\n\tt *testing.T,\n\tgenProgram GenProgram,\n\tgenProject GenProject,\n)\n```\n\n```go\nfunc GeneratePythonYAMLBatchTest(t *testing.T, rootDir string, genProgram GenProgram)\n```\n\n```go\nfunc LoadBaseline(dir, lang string) (map[string][]byte, error)\n```\n\\`LoadBaseline\\` loads the contents of the given baseline directory, by inspecting its \\`codegen-manifest.json\\`.\n\n```go\nfunc LoadFiles(dir, lang string, files []string) (map[string][]byte, error)\n```\nLoadFiles loads the provided list of files from a directory.\n\n```go\nfunc NoSDKCodegenChecks() bool\n```\n\n```go\nfunc PathExists(path string) (bool, error)\n```\n\n```go\nfunc RewriteFilesWhenCodeinfraAccept(t *testing.T, dir, lang string, actual map[string][]byte) bool\n```\nIf CODEINFRA\\_ACCEPT is set, writes out actual output to the expected file set, so we can continue enjoying golden tests without manually modifying the expected output.\n\n```go\nfunc RunCommand(t *testing.T, name string, cwd string, exec string, args ...string)\n```\n\n```go\nfunc RunCommandWithOptions(\n\tt *testing.T,\n\topts *integration.ProgramTestOptions,\n\tname string, cwd string, exec string, args ...string,\n)\n```\n\n```go\nfunc TestProgramCodegen(\n\tt *testing.T,\n\ttestcase ProgramCodegenOptions,\n)\n```\nTestProgramCodegen runs the complete set of program code generation tests against a particular language's code generator.\n\nA program code generation test consists of a PCL file (.pp extension) and a set of expected outputs for each language.\n\nThe PCL file is the only piece that must be manually authored. Once the schema has been written, the expected outputs can be generated by running \\`CODEINFRA\\_ACCEPT=true go test ./...\" from the \\`pkg/codegen\\` directory.\n\n```go\nfunc TestSDKCodegen(t *testing.T, opts *SDKCodegenOptions)\n```\nTestSDKCodegen runs the complete set of SDK code generation tests against a particular language's code generator. It also verifies that the generated code is structurally sound.\n\nThe test files live in \\`pkg/codegen/testing/test/testdata\\` and are registered in \\`var sdkTests\\` in \\`sdk\\_driver.go\\`.\n\nAn SDK code generation test files consists of a schema and a set of expected outputs for each language. Each test is structured as a directory that contains that information:\n\n\ttestdata/\n\t    my-simple-schema/   # i.e. `simple-enum-schema`\n\t        schema.(json|yaml)\n\t        go/\n\t        python/\n\t        nodejs/\n\t        dotnet/\n\t        ...\n\nThe schema is the only piece that \\*must\\* be manually authored.\n\nOnce the schema has been written, the actual codegen outputs can be generated by running the following in \\`pkg/codegen\\` directory:\n\n\tCODEINFRA_ACCEPT=true go test ./...\n\nThis will rebuild subfolders such as \\`go/\\` from scratch and store the set of code-generated file names in \\`go/codegen-manifest.json\\`. If these outputs look correct, they need to be checked into git and will then serve as the expected values for the normal test runs:\n\n\tgo test ./...\n\nThat is, the normal test runs will fail if changes to codegen or schema lead to a diff in the generated file set. If the diff is intentional, it can be accepted again via \\`CODEINFRA\\_ACCEPT=true\\`.\n\nTo support running unit tests over the generated code, the tests also support mixing in manually written \\`$lang-extras\\` files into the generated tree. For example, given the following input:\n\n\ttestdata/\n\t    my-simple-schema/\n\t        schema.json\n\t        go/\n\t        go-extras/\n\t            tests/\n\t                go_test.go\n\nThe system will copy \\`go-extras/tests/go\\_test.go\\` into \\`go/tests/go\\_test.go\\` before performing compilation and unit test checks over the project generated in \\`go\\`.\n\n```go\nfunc TestTypeNameCodegen(t *testing.T, language string, newTypeNameGenerator NewTypeNameGeneratorFunc)\n```\n\n```go\nfunc TypeCheckNodeJSPackage(t *testing.T, pwd string, linkLocal bool)\n```\n\n```go\nfunc ValidateFileEquality(t *testing.T, actual, expected map[string][]byte) bool\n```\nValidateFileEquality compares maps of files for equality.\n\n```go\nfunc ValidateFileTransformer(\n\tt *testing.T,\n\tinputFile string,\n\texpectedOutputFile string,\n\ttransformer func(reader io.Reader, writer io.Writer) error,\n)\n```\nValidates a transformer on a single file.\n\n## Types\n\n```go\ntype CheckProgramOutput = func(*testing.T, string, codegen.StringSet)\n```\nChecks that a generated program is correct\n\nThe arguments are to be read: (Testing environment, path to generated code, set of dependencies)\n\n```go\ntype CodegenCheck func(t *testing.T, codedir string)\n```\nDefines an extra check logic that accepts the directory with the generated code, typically \\`$TestDir/$test.Directory/$language\\`.\n\n```go\ntype GenPkgSignature func(string, *schema.Package, map[string][]byte) (map[string][]byte, error)\n```\nGenPkgSignature corresponds to the shape of the codegen GeneratePackage functions.\n\n```go\ntype GenProgram = func(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error)\n```\nGenerates a program from a pcl.Program\n\n```go\ntype GenProject = func(\n\tdirectory string, project workspace.Project,\n\tprogram *pcl.Program, localDependencies map[string]string,\n) error\n```\nGenerates a project from a pcl.Program\n\n```go\ntype NewTypeNameGeneratorFunc func(pkg *schema.Package) TypeNameGeneratorFunc\n```\n\n```go\ntype PkgVersionInfo struct {\n\tPkg          string\n\tOpAndVersion string\n}\n```\n\n```go\ntype ProgramCodegenOptions struct {\n\tLanguage   string\n\tExtension  string\n\tOutputFile string\n\tCheck      CheckProgramOutput\n\tGenProgram GenProgram\n\tTestCases  []ProgramTest\n\n\t// For generating a full project\n\tIsGenProject bool\n\tGenProject   GenProject\n\t// Maps a test file (i.e. \"aws-resource-options\") to a struct containing a package\n\t// (i.e. \"github.com/khulnasoft/codeinfra-aws/sdk/v5\", \"codeinfra-aws) and its\n\t// version prefixed by an operator (i.e. \" v5.11.0\", ==5.11.0\")\n\tExpectedVersion map[string]PkgVersionInfo\n\tDependencyFile  string\n}\n```\n\n```go\ntype ProgramTest struct {\n\tDirectory          string\n\tDescription        string\n\tSkip               codegen.StringSet\n\tExpectNYIDiags     codegen.StringSet\n\tSkipCompile        codegen.StringSet\n\tBindOptions        []pcl.BindOption\n\tMockPluginVersions map[string]string\n\tPluginHost         plugin.Host\n}\n```\n\n```go\nfunc ProgramTestBatch(k, n int) []ProgramTest\n```\nGet batch number k (base-1 indexed) of tests out of n batches total.\n\n```go\nfunc SingleTestCase(directoryName string) []ProgramTest\n```\nUseful when debugging a single test case.\n\n```go\ntype SDKCodegenOptions struct {\n\t// Name of the programming language.\n\tLanguage string\n\n\t// Language-aware code generator; such as `GeneratePackage`.\n\t// from `codegen/dotnet`.\n\tGenPackage GenPkgSignature\n\n\t// Extra checks for all the tests. They keys of this map are\n\t// of the form \"$language/$check\" such as \"go/compile\".\n\tChecks map[string]CodegenCheck\n\n\t// The tests to run. A testcase `tt` are assumed to be located at\n\t// ../testing/test/testdata/${tt.Directory}\n\tTestCases []*SDKTest\n}\n```\nSDKCodegenOptions describes the set of codegen tests for a language.\n\n```go\ntype SDKTest struct {\n\tDirectory   string\n\tDescription string\n\n\t// Extra checks for this test. They keys of this map\n\t// are of the form \"$language/$check\" such as \"go/compile\".\n\tChecks map[string]CodegenCheck\n\n\t// Skip checks, identified by \"$language/$check\".\n\t// \"$language/any\" is special, skipping generating the\n\t// code as well as all tests.\n\tSkip codegen.StringSet\n\n\t// Do not compile the generated code for the languages in this set.\n\t// This is a helper form of `Skip`.\n\tSkipCompileCheck codegen.StringSet\n\n\t// Mutex to ensure only a single test operates on directory at a time\n\tMutex sync.Mutex\n}\n```\n\n```go\nfunc (tt *SDKTest) ShouldSkipCodegen(language string) bool\n```\nShouldSkipCodegen determines if codegen should be run. ShouldSkipCodegen=true further implies no other tests will be run.\n\n```go\nfunc (tt *SDKTest) ShouldSkipTest(language, test string) bool\n```\nShouldSkipTest indicates if a given test for a given language should be run.\n\n```go\ntype SchemaVersion = string\n```\n\n```go\nconst (\n\tAwsSchema              SchemaVersion = \"4.26.0\"\n\tAzureNativeSchema      SchemaVersion = \"1.29.0\"\n\tAzureSchema            SchemaVersion = \"4.18.0\"\n\tKubernetesSchema       SchemaVersion = \"3.7.2\"\n\tRandomSchema           SchemaVersion = \"4.11.2\"\n\tEksSchema              SchemaVersion = \"0.37.1\"\n\tAwsStaticWebsiteSchema SchemaVersion = \"0.4.0\"\n\tAwsNativeSchema        SchemaVersion = \"0.99.0\"\n)\n```\nSchemas are downloaded in the makefile, and the versions specified here should be in sync with the makefile.\n\n```go\ntype TypeNameGeneratorFunc func(t schema.Type) string\n```\n\n","path":"github.com/khulnasoft/codeinfra/pkg/v3/codegen/testing/test","name":"test","synopsis":"","isRedistributable":true}
