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

tests/provider: Use Standard Terraform Plugin SDK TestCheckFunc #77

Open
bflad opened this issue Jun 29, 2021 · 0 comments
Open

tests/provider: Use Standard Terraform Plugin SDK TestCheckFunc #77

bflad opened this issue Jun 29, 2021 · 0 comments

Comments

@bflad
Copy link
Contributor

bflad commented Jun 29, 2021

Terraform Version

N/A (provider acceptance testing)

Affected Resource(s)

  • local_file

Expected Behavior

Testing would use available Terraform Plugin SDK TestCheckFunc where possible.

Actual Behavior

Certain places are manually checking the Terraform state values instead of using helpers, such as helper/resource.TestCheckResourceAttr().

References

  • Check: func(s *terraform.State) error {
    m := s.RootModule()
    i := m.Resources["data.local_file.file"].Primary
    if got, want := i.Attributes["content"], test.content; got != want {
    return fmt.Errorf("wrong content %q; want %q", got, want)
    }
    if got, want := i.Attributes["content_base64"], base64.StdEncoding.EncodeToString([]byte(test.content)); got != want {
    return fmt.Errorf("wrong content_base64 %q; want %q", got, want)
    }
    return nil
    },
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

No branches or pull requests

1 participant