run-acceptance-tests

द्वारा hashicorp

Terraform प्रदाताओं के लिए Go स्वीकृति परीक्षणों को संरचित समस्या निवारण के साथ निष्पादित और निदान करें। TF_ACC=1 पर्यावरण चर के साथ go test -run=TestAccFeatureHappyPath का उपयोग करके केंद्रित स्वीकृति परीक्षण चलाएं। विफलताओं का क्रमिक रूप से निदान करें: -count=1 के साथ पुनः प्रयास करें, -v के साथ विस्तृत आउटपुट सक्षम करें, TF_LOG=debug के माध्यम से डीबग लॉगिंग सक्रिय करें, और TF_ACC_WORKING_DIR_PERSIST=1 के साथ Terraform कार्यक्षेत्र को बनाए रख

npx skills add https://github.com/hashicorp/agent-skills --skill run-acceptance-tests

An acceptance test is a Go test function with the prefix TestAcc.

Before running: acceptance tests create real infrastructure against the provider's live API, which may incur cost. Confirm the configured credentials point at a test account before proceeding.

To run a focused acceptance test named TestAccFeatureHappyPath:

  1. Run go test -run=TestAccFeatureHappyPath -timeout 60m with the following environment variables:

    • TF_ACC=1

    Default to non-verbose test output. Always pass an explicit -timeout: go test kills any test run after 10 minutes by default, and acceptance tests routinely exceed that.

  2. The acceptance tests may require additional environment variables for specific providers. To discover which ones:

    • Read the test's PreCheck / testAccPreCheck function and search the test files: grep -rn "os.Getenv" --include="*_test.go".
    • Check the repository's README, CONTRIBUTING, or .env.example for documented test setup.
    • The provider's Configure method shows how credentials are resolved; use the provider-configuration skill (if available) to understand a credential provider chain.

    Set the variables for the single test invocation (EXAMPLE_API_KEY=... TF_ACC=1 go test ...) rather than exporting them into the shell profile, and never write secret values into files inside the repository.

To diagnose a failing acceptance test, use these options, in order. These options are cumulative: each option includes all the options above it.

  1. Run the test again. Use the -count=1 option to ensure that go test does not use a cached result.
  2. Offer verbose go test output. Use the -v option.
  3. Offer debug-level logging. Enable debug-level logging with the environment variable TF_LOG=debug.
  4. Offer to persist the acceptance test's Terraform workspace. Enable persistence with the environment variable TF_ACC_WORKING_DIR_PERSIST=1.

A passing acceptance test may be a false negative. To "flip" a passing acceptance test named TestAccFeatureHappyPath:

  1. Edit the value of one of the TestCheckFuncs in one of the TestSteps in the TestCase.
  2. Run the acceptance test. Expect the test to fail.
  3. If the test fails, then undo the edit and report a successful flip. Else, keep the edit and report an unsuccessful flip.

If a test run is interrupted, real resources may be left behind; run the provider's sweepers if it registers them (see the provider-test-patterns skill's sweeper reference, if available). For writing or restructuring tests, use the provider-test-patterns skill.

hashicorp की और Skills

provider-actions
hashicorp
Implement Terraform Provider actions using the Plugin Framework. Use when developing imperative operations that execute at lifecycle events (before/after…
official
new-terraform-provider
hashicorp
Use this when scaffolding a new Terraform provider with the Plugin Framework: workspace layout, go module setup, provider server main.go, and a provider.go…
official
terraform-test
hashicorp
Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating…
official
terraform-test
hashicorp
Terraform परीक्षण लिखने और चलाने के लिए व्यापक मार्गदर्शिका, जिसमें अभिकथन, मॉकिंग और मॉड्यूल सत्यापन शामिल हैं। .tftest.hcl सिंटैक्स का उपयोग करके परीक्षण फ़ाइलें लिखें, जिनमें रन ब्लॉक हों जो प्लान या अप्लाई मोड में निष्पादित हों, अनुक्रमिक और समानांतर निष्पादन का समर्थन करते हुए वैकल्पिक स्थिति पृथक्करण के साथ। संसाधन विशेषताओं, आउटपुट और डेटा स्रोतों पर शर्तों का अभिकथन करें; अमान्य इ
official
provider-actions
hashicorp
प्लगइन फ्रेमवर्क का उपयोग करके संसाधन जीवनचक्र घटनाओं पर अनिवार्य Terraform प्रदाता क्रियाएँ लागू करें। बनाने से पहले/बाद और अपडेट करने से पहले/बाद जीवनचक्र ट्रिगर का समर्थन करता है (Terraform 1.14.0 में नष्ट करने की घटनाएँ उपलब्ध नहीं हैं)। सही फ्रेमवर्क प्रकार, संग्रह के लिए ElementType और इनपुट सत्यापन के लिए वैलिडेटर के साथ उचित स्कीमा परिभाषा की आवश्यकता है। लंबे समय तक चलने वाले संच
official
aws-ami-builder
hashicorp
Packer के amazon-ebs बिल्डर के साथ कस्टम Amazon Machine Images बनाएं। स्रोत AMI से HCL टेम्पलेट्स का उपयोग करके AMI निर्माण को स्वचालित करता है, जिसमें अनुकूलन के लिए प्रोविज़नर (शेल स्क्रिप्ट, फ़ाइल अपलोड, कॉन्फ़िगरेशन प्रबंधन) शामिल हैं। ami_regions के माध्यम से बहु-क्षेत्र AMI वितरण और नाम, स्वामी और वर्चुअलाइज़ेशन प्रकार के आधार पर लचीली स्रोत AMI फ़िल्टरिंग का समर्थन करता है। पर्यावरण चर, AWS क्रेडेंशियल फ़ाइल या
official
new-terraform-provider
hashicorp
Plugin Framework का उपयोग करके एक नया Terraform प्रदाता तैयार करें। मानक "terraform-provider-" नामकरण परंपरा के साथ एक नया Go मॉड्यूल वर्कस्पेस उत्पन्न करता है और आवश्यक निर्भरताओं को आरंभ करता है। HashiCorp के Plugin Framework पैटर्न का पालन करते हुए एक टेम्पलेट main.go फ़ाइल प्रदान करता है, जिसमें अनुकूलन के लिए TODO मार्कर होते हैं। बिल्ड और टेस्ट कमांड चलाकर सेटअप को मान्य करता है ताकि यह सुनिश्चित हो सके कि प्रदाता संकलित होता है और प्रारंभिक जांच पास कर
official
azure-verified-modules
hashicorp
Azure Terraform मॉड्यूल के लिए AVM अनुपालन हेतु प्रमाणन आवश्यकताएँ और सर्वोत्तम अभ्यास। प्रदाता संस्करण बाधाओं (azurerm >= 4.0, < 5.0; azapi >= 2.0, < 3.0) को लागू करता है और पिन किए गए Terraform रजिस्ट्री स्रोतों के पक्ष में git-आधारित मॉड्यूल संदर्भों को प्रतिबंधित करता है। सभी पहचानकर्ताओं के लिए लोअर स्नेक_केसिंग, सटीक चर प्रकार, एंटी-भ्रष्टाचार परत पैटर्न के माध्यम से अलग-अलग आउटपुट
official