Skip to content

Conversation

@Ak-sky
Copy link
Member

@Ak-sky Ak-sky commented Nov 27, 2025

Description

Validation fix for type mismatch errors for catalog inputs.

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

Copy link
Contributor

@daniel-butler-irl daniel-butler-irl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add or update some of the test data for the mismatch types to ensure different widgets work https://github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/tree/main/cloudinfo/testdata

I am not sure if we should add new tests or enhance the existing mismatch type test

@Ak-sky
Copy link
Member Author

Ak-sky commented Nov 27, 2025

Please add or update some of the test data for the mismatch types to ensure different widgets work https://github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/tree/main/cloudinfo/testdata

I am not sure if we should add new tests or enhance the existing mismatch type test

@daniel-butler-irl
I have updated the test in this file ibm_catalog_with_config_overrides_type_mismatch and renamed it with ibm_catalog_with_config_overrides_type_and_type_metadata_mismatch

whoffler
whoffler previously approved these changes Nov 28, 2025
@daniel-butler-irl
Copy link
Contributor

/run pipeline

@Ak-sky
Copy link
Member Author

Ak-sky commented Nov 30, 2025

/run pipeline

@Ak-sky
Copy link
Member Author

Ak-sky commented Dec 1, 2025

/run pipeline

1 similar comment
@Ak-sky
Copy link
Member Author

Ak-sky commented Dec 1, 2025

/run pipeline

@Ak-sky
Copy link
Member Author

Ak-sky commented Dec 1, 2025

Unit tests were failing, added new tests.

=== RUN   TestProjectsServiceTestSuite/TestCreateStackFromConfigFile/Default_values_from_ibm_catalog.json,_should_override_values_from_stack_definition.json
    projects_test.go:1132: 
        	Error Trace:	/__w/ibmcloud-terratest-wrapper/ibmcloud-terratest-wrapper/cloudinfo/projects_test.go:1132
        	            				/go/pkg/mod/github.com/stretchr/testify@v1.11.1/suite/suite.go:115
        	Error:      	Not equal: 
        	            	expected: &projectv1.StackDefinition{ID:(*string)(0xc000587c90), CreatedAt:(*strfmt.DateTime)(nil), ModifiedAt:(*strfmt.DateTime)(nil), Configuration:(*projectv1.StackDefinitionMetadataConfiguration)(nil), Href:(*string)(nil), StackDefinition:(*projectv1.StackDefinitionBlock)(0xc000610050)}
        	            	actual  : &projectv1.StackDefinition{ID:(*string)(0xc00048f6a0), CreatedAt:(*strfmt.DateTime)(nil), ModifiedAt:(*strfmt.DateTime)(nil), Configuration:(*projectv1.StackDefinitionMetadataConfiguration)(nil), Href:(*string)(nil), StackDefinition:(*projectv1.StackDefinitionBlock)(0xc000446460)}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -7,3 +7,3 @@
        	            	  StackDefinition: (*projectv1.StackDefinitionBlock)({
        	            	-  Inputs: ([]projectv1.StackDefinitionInputVariable) (len=4) {
        	            	+  Inputs: ([]projectv1.StackDefinitionInputVariable) (len=7) {
        	            	    (projectv1.StackDefinitionInputVariable) {
        	            	@@ -37,2 +37,26 @@
        	            	     Default: (*bool)(true),
        	            	+    Required: (*bool)(false),
        	            	+    Hidden: (*bool)(false)
        	            	+   },
        	            	+   (projectv1.StackDefinitionInputVariable) {
        	            	+    Name: (*string)((len=6) "input5"),
        	            	+    Type: (*string)((len=6) "string"),
        	            	+    Description: (*string)(""),
        	            	+    Default: (*string)((len=13) "stack_value_5"),
        	            	+    Required: (*bool)(false),
        	            	+    Hidden: (*bool)(false)
        	            	+   },
        	            	+   (projectv1.StackDefinitionInputVariable) {
        	            	+    Name: (*string)((len=6) "input6"),
        	            	+    Type: (*string)((len=6) "string"),
        	            	+    Description: (*string)(""),
        	            	+    Default: (*string)((len=13) "stack_value_6"),
        	            	+    Required: (*bool)(false),
        	            	+    Hidden: (*bool)(false)
        	            	+   },
        	            	+   (projectv1.StackDefinitionInputVariable) {
        	            	+    Name: (*string)((len=6) "input7"),
        	            	+    Type: (*string)((len=6) "string"),
        	            	+    Description: (*string)(""),
        	            	+    Default: (*string)((len=13) "stack_value_7"),
        	            	     Required: (*bool)(false),
        	Test:       	TestProjectsServiceTestSuite/TestCreateStackFromConfigFile/Default_values_from_ibm_catalog.json,_should_override_values_from_stack_definition.json
=== RUN   TestProjectsServiceTestSuite/TestCreateStackFromConfigFile/Default_values_from_ibm_catalog.json_with_a_default_not_set,_should_override_values_from_stack_definition.json
    projects_test.go:1132: 
        	Error Trace:	/__w/ibmcloud-terratest-wrapper/ibmcloud-terratest-wrapper/cloudinfo/projects_test.go:1132
        	            				/go/pkg/mod/github.com/stretchr/testify@v1.11.1/suite/suite.go:115
        	Error:      	Not equal: 
        	            	expected: &projectv1.StackDefinition{ID:(*string)(0xc000587ec0), CreatedAt:(*strfmt.DateTime)(nil), ModifiedAt:(*strfmt.DateTime)(nil), Configuration:(*projectv1.StackDefinitionMetadataConfiguration)(nil), Href:(*string)(nil), StackDefinition:(*projectv1.StackDefinitionBlock)(0xc000610190)}
        	            	actual  : &projectv1.StackDefinition{ID:(*string)(0xc000607540), CreatedAt:(*strfmt.DateTime)(nil), ModifiedAt:(*strfmt.DateTime)(nil), Configuration:(*projectv1.StackDefinitionMetadataConfiguration)(nil), Href:(*string)(nil), StackDefinition:(*projectv1.StackDefinitionBlock)(0xc000446690)}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -7,3 +7,3 @@
        	            	  StackDefinition: (*projectv1.StackDefinitionBlock)({
        	            	-  Inputs: ([]projectv1.StackDefinitionInputVariable) (len=4) {
        	            	+  Inputs: ([]projectv1.StackDefinitionInputVariable) (len=7) {
        	            	    (projectv1.StackDefinitionInputVariable) {
        	            	@@ -37,2 +37,26 @@
        	            	     Default: (*bool)(false),
        	            	+    Required: (*bool)(false),
        	            	+    Hidden: (*bool)(false)
        	            	+   },
        	            	+   (projectv1.StackDefinitionInputVariable) {
        	            	+    Name: (*string)((len=6) "input5"),
        	            	+    Type: (*string)((len=6) "string"),
        	            	+    Description: (*string)(""),
        	            	+    Default: (*string)((len=13) "stack_value_5"),
        	            	+    Required: (*bool)(false),
        	            	+    Hidden: (*bool)(false)
        	            	+   },
        	            	+   (projectv1.StackDefinitionInputVariable) {
        	            	+    Name: (*string)((len=6) "input6"),
        	            	+    Type: (*string)((len=6) "string"),
        	            	+    Description: (*string)(""),
        	            	+    Default: (*string)((len=13) "stack_value_6"),
        	            	+    Required: (*bool)(false),
        	            	+    Hidden: (*bool)(false)
        	            	+   },
        	            	+   (projectv1.StackDefinitionInputVariable) {
        	            	+    Name: (*string)((len=6) "input7"),
        	            	+    Type: (*string)((len=6) "string"),
        	            	+    Description: (*string)(""),
        	            	+    Default: (*string)((len=13) "stack_value_7"),
        	            	     Required: (*bool)(false),
        	Test:       	TestProjectsServiceTestSuite/TestCreateStackFromConfigFile/Default_values_from_ibm_catalog.json_with_a_default_not_set,_should_override_values_from_stack_definition.json

So had to redo some stuff.

@Ak-sky
Copy link
Member Author

Ak-sky commented Dec 1, 2025

/run pipeline

@Ak-sky
Copy link
Member Author

Ak-sky commented Dec 1, 2025

/run pipeline

@Ak-sky Ak-sky requested a review from whoffler December 1, 2025 18:27
@Ak-sky
Copy link
Member Author

Ak-sky commented Dec 2, 2025

/run pipeline

@Ak-sky Ak-sky requested a review from whoffler December 2, 2025 13:35
stackConfigPath: "testdata/stack_definition_with_type_metadata_only.json",
catalogJsonPath: "testdata/ibm_catalog_with_type_metadata_only.json",
expectedConfig: nil,
expectedError: fmt.Errorf("catalog configuration type_metadata mismatch in product 'Product Name', flavor 'Flavor Name': input5 expected type: string, got: int\n" +
Copy link
Contributor

@whoffler whoffler Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this read

"catalog configuration type_metadata mismatch in product 'Product Name', flavor 'Flavor Name': input5 expected type: int, got: string\n"

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expectedType is string from stack definition and catalog catalogInput.TypeMetadata is int, so this should be correct!

stack def-

  "inputs": [
    {
      "name": "input5",
      "required": false,
      "type_metadata": "string",
      "hidden": false,
      "default": "stack_value_5"
    },

catalog val-

          "configuration": [
            {
              "key": "input5",
              "type_metadata": "int",
              "description": "Description for input5",
              "default_value": "default_value_5",
              "required": false,
              "display_name": "Input 5"
            },

catalogJsonPath: "testdata/ibm_catalog_with_type_metadata_only.json",
expectedConfig: nil,
expectedError: fmt.Errorf("catalog configuration type_metadata mismatch in product 'Product Name', flavor 'Flavor Name': input5 expected type: string, got: int\n" +
"catalog configuration type_metadata mismatch in product 'Product Name', flavor 'Flavor Name': input6 expected type: string, got: bool"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this

"catalog configuration type_metadata mismatch in product 'Product Name', flavor 'Flavor Name': input6 expected type: bool, got: string"),

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also

stack def-

    {
      "name": "input6",
      "required": false,
      "type_metadata": "string",
      "hidden": false,
      "default": "stack_value_6"
    },

catalog val-

            {
              "key": "input6",
              "type_metadata": "bool",
              "description": "Description for input6",
              "default_value": "",
              "required": false,
              "display_name": "Input 6"
            },

@Ak-sky Ak-sky requested a review from whoffler December 2, 2025 23:22
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.

4 participants