generated from hashicorp/terraform-provider-scaffolding-framework
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Several utility functions in the codebase currently lack unit test coverage. This issue tracks the effort to add comprehensive unit tests for these functions to improve code quality, prevent regressions, and ensure reliable behavior.
Motivation
- Improve overall test coverage for utility functions
- Prevent regressions when making changes to core utility code
- Ensure edge cases and error conditions are properly handled
- Maintain code quality standards across the project
Missing Unit Tests Checklist
The following utility functions need unit test coverage:
High Priority (Pure Functions)
-
IsKnownfunction ininternal/utils/schema.go- checks if an attribute value is known and not null -
MissingElementsfunction ininternal/utils/schema.go- compares string slices and returns elements from sliceathat are missing from sliceb -
SetInt64FromAPIIfNotZerofunction ininternal/utils/schema.go- conditionally sets Int64 values from API responses -
SetStringFromAPIIfNotEmptyfunction ininternal/utils/schema.go- conditionally sets String values from API responses -
OptionalStringfunction ininternal/utils/schema.go- converts string pointer to types.String -
MarkdownDescriptionfunction ininternal/utils/schema.go- formats markdown descriptions with API scopes -
getRoleNameFromArnfunction ininternal/fcs/utils.go- extracts role name from AWS ARN string -
AttributeTypesmethod ininternal/content_update_policy/rings.go- returns attribute type mapping for ring assignment model
Medium Priority (Require Setup)
-
SliceToListTypeStringfunction ininternal/utils/schema.go- converts string slice to Terraform List type -
SliceToListTypeObjectfunction ininternal/utils/schema.go- converts generic slice to Terraform List of objects -
ValidateEmptyIDsfunction ininternal/utils/schema.go- validates that set doesn't contain empty ID strings -
ValidateEmptyIDsListfunction ininternal/utils/schema.go- validates that list doesn't contain empty ID strings -
ConvertModelToTerraformObjectfunction ininternal/utils/schema.go- converts model structs to Terraform objects -
wrapmethod ininternal/content_update_policy/rings.go- converts API model to internal ring assignment model -
buildRingAssignmentSettingsfunction ininternal/content_update_policy/rings.go- converts internal models to API request models - Ring assignment validation functions in
internal/content_update_policy/validation.go- complex validation logic for ring assignments and pinned versions
Implementation Notes
- Start with high priority pure functions as they're easiest to test
- Focus on utility functions that are widely used across the codebase
- Ensure tests cover both happy path and edge cases
- Follow existing test patterns in the codebase
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request