Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #635: added missing Default #647

Merged
merged 2 commits into from
Nov 4, 2024
Merged

Conversation

jenxie
Copy link
Contributor

@jenxie jenxie commented Oct 12, 2024

Fixes #635: Added missing Default to data in resourceNetboxCustomField and resourceNetboxCustomFieldCreate

default value is now created correctly:

{
      ...
      "id": 1,
      "url": "http://localhost:8001/api/extras/custom-fields/1/",
      "display": "test",
      ...
      "data_type": "string",
      "name": "test",
      "label": "test",
      ...
      "default": "\"default value ignored\"",
      "weight": 100,
      ...
    }
  ]
}

UI screenshot:
image

@jenxie jenxie changed the title Fixes 635: added missing Default Fixes #635: added missing Default Oct 12, 2024
@jenxie jenxie changed the title Fixes #635: added missing Default Fixes e-breuninger/terraform-provider-netbox#635: added missing Default Oct 12, 2024
@jenxie jenxie changed the title Fixes e-breuninger/terraform-provider-netbox#635: added missing Default Fixes #635: added missing Default Oct 12, 2024
@jenxie
Copy link
Contributor Author

jenxie commented Oct 13, 2024

Failed test:

=== NAME  TestAccNetboxDeviceInterfacesDataSource_basic
    testing_new.go:85: Error running post-test destroy, there may be dangling resources: exit status 1
        
        Error: 0xc00304b4a8 (*interface {}) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface
        
--- FAIL: TestAccNetboxDeviceInterfacesDataSource_basic (8.18s)

seems fine running it locally:

jenxie/terraform-provider-netbox > issue-635 <]$ TEST_FUNC=TestAccNetboxDeviceInterfacesDataSource_basic make testacc-specific-test
⌛ Startup acceptance tests on http://localhost:8001 with version v4.0.11
⌛ Testing function TestAccNetboxDeviceInterfacesDataSource_basic
TF_ACC=1 go test -timeout 20m -v -cover netbox/*.go -run TestAccNetboxDeviceInterfacesDataSource_basic
=== RUN   TestAccNetboxDeviceInterfacesDataSource_basic
=== PAUSE TestAccNetboxDeviceInterfacesDataSource_basic
=== CONT  TestAccNetboxDeviceInterfacesDataSource_basic
--- PASS: TestAccNetboxDeviceInterfacesDataSource_basic (13.52s)
PASS
coverage: 8.3% of statements
ok  	command-line-arguments	13.534s	coverage: 8.3% of statements

@fbreckle
Copy link
Collaborator

Please add a test that uses this feature. You will probably see that it will fail because you are not updating the schema.

@jenxie
Copy link
Contributor Author

jenxie commented Oct 14, 2024

Please add a test that uses this feature. You will probably see that it will fail because you are not updating the schema.

Thank you for pointing that out.

Added the test, I believe the schema update was already done beforehand at line 60:

			"default": {
				Type:     schema.TypeString,
				Optional: true,
			},

Hence I'm not getting an error after adding the test (however, removing it makes the test fail).

Running the full suite of acceptance tests with make testacc completed without any errors

PASS
coverage: 75.3% of statements
ok  	command-line-arguments	709.561s	coverage: 75.3% of statements

Hopefully I haven't misunderstood it completely :)

@fbreckle fbreckle merged commit c0d33d3 into e-breuninger:master Nov 4, 2024
15 checks passed
@jenxie jenxie deleted the issue-635 branch November 4, 2024 08:51
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.

netbox_custom_field ignoring default field
2 participants