Comments (6)
Hi @zackpollard, is this with make mockacc
or with make testacc
?
from terraform-provider-commercetools.
This is running with make testacc
. Having a space in a key in commercetools is not valid, but i'm guessing it is in the mock server? Unsure what's up with the first error though, would need to investigate more.
from terraform-provider-commercetools.
Not sure if I should create a new issue, but Discount Code resource acceptance tests are also failing, I tried looking into it thinking that there might be some issues in the terraform hlc but couldn't notice anything obvious:
Error:
=== RUN TestAccDiscountCodeCreate_basic
TestAccDiscountCodeCreate_basic: testing.go:654: Step 0 error: errors during apply:
Error: Request body does not contain valid JSON.
on /var/folders/6_/0g9n8_wn54b4df2znjp9ryc00000gn/T/tf-test656977397/main.tf line 2:
(source code not available)
--- FAIL: TestAccDiscountCodeCreate_basic (0.29s)
from terraform-provider-commercetools.
I believe I've been able to further debug this issue. For me only the TestAccDiscountCodeCreate_basic
is failing locally when I run make testacc
, so that's what I've investigated.
I updated the following line to log the cart draft that is being created:
+ str, _ := json.Marshal(draft)
+ log.Printf("Creating discount code %s", str)
discountCode, err = client.DiscountCodeCreate(draft)
That produces the following:
{"validUntil":"2021-01-02T15:04:05Z","validFrom":"2020-01-02T15:04:05Z","name":{"en":"Standard name"},"maxApplicationsPerCustomer":10,"maxApplications":100,"isActive":true,"description":{"en":"Standard description"},"code":"2","cartPredicate":"1=1","cartDiscounts":[{"typeId":"cart-discount","id":"cart-discount-id-0"},{"typeId":"cart-discount","id":"cart-discount-id-1"}]}
Feeding that into IMPEX resulted in the following error:
{
"statusCode": 400,
"message": "Request body does not contain valid JSON.",
"errors": [
{
"code": "InvalidJsonInput",
"message": "Request body does not contain valid JSON.",
"detailedErrorMessage": "cartDiscounts -> id: Invalid UUID: 'cart-discount-id-0'"
},
{
"code": "InvalidJsonInput",
"message": "Request body does not contain valid JSON.",
"detailedErrorMessage": "cartDiscounts -> id: Invalid UUID: 'cart-discount-id-1'"
}
]
}
Making the following change in the testAccDiscountCodeConfig
function results in a new error:
-cart_discounts = ["cart-discount-id-0", "cart-discount-id-1"]
+cart_discounts = ["ac5d0ae0-e650-4ddc-999b-c706d0271438", "73151624-0375-4c17-9f54-c738d2504265"]
TestAccDiscountCodeCreate_basic: testing.go:654: Step 0 error: errors during apply:
Error: Cart Discount 'ac5d0ae0-e650-4ddc-999b-c706d0271438' doesn't exist.
on /var/folders/v7/hnrvx86s6fsfpcyndw9gtj2h0000gq/T/tf-test283912456/main.tf line 2:
(source code not available)
This looks like an easy fix but I'm not sure on the correct approach for this repo:
- Do we add in the cart discount resources as a dependency of this acceptance test?
- We're unable to remove the cart discounts as that also results in a 400.
- Is there a separate setup step we can use to add known fixtures for acceptance tests?
I'm also unsure about fixing this, given that the acceptance tests are not run in CI (they're run against a mock server) - should we instead ensure these tests are run regularly to avoid any regression?
Let me know your thoughts on the above, I'm happy to open a PR for whichever strategy makes sense if I find some time.
from terraform-provider-commercetools.
Thanks for all the input. The tests in Cart Discount were fixed in #140 .
Full run now results in:
TF_ACC=1 go test -v ./...
? github.com/labd/terraform-provider-commercetools [no test files]
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN TestAPIExtensionGetDestination
--- PASS: TestAPIExtensionGetDestination (0.00s)
=== RUN TestAPIExtensionGetAuthentication
--- PASS: TestAPIExtensionGetAuthentication (0.00s)
=== RUN TestAccAPIExtension_basic
--- PASS: TestAccAPIExtension_basic (1.27s)
=== RUN TestAccCartDiscountCreate_basic
--- PASS: TestAccCartDiscountCreate_basic (1.15s)
=== RUN TestAccCustomObjectCreate_basic
testing.go:684: Step 1 error: Check failed: Check 4/4 error: commercetools_custom_object.test_number: Attribute 'version' expected "2", got "1"
--- FAIL: TestAccCustomObjectCreate_basic (0.19s)
=== RUN TestAccCustomObjectCreate_object
--- PASS: TestAccCustomObjectCreate_object (0.10s)
=== RUN TestAccCustomerGroupCreate_basic
--- PASS: TestAccCustomerGroupCreate_basic (1.17s)
=== RUN TestAccDiscountCodeCreate_basic
--- PASS: TestAccDiscountCodeCreate_basic (1.19s)
=== RUN TestAttributeTypeElement
--- PASS: TestAttributeTypeElement (0.00s)
=== RUN TestGetAttributeType
--- PASS: TestGetAttributeType (0.00s)
=== RUN TestAccProductTypes_basic
--- PASS: TestAccProductTypes_basic (0.70s)
=== RUN TestAccProjectCreate_basic
--- PASS: TestAccProjectCreate_basic (0.96s)
=== RUN TestAccShippingMethod_createAndUpdateWithID
--- PASS: TestAccShippingMethod_createAndUpdateWithID (0.85s)
=== RUN TestAccShippingZoneRate_create
--- PASS: TestAccShippingZoneRate_create (0.67s)
=== RUN TestAccShippingZone_createAndUpdateWithID
--- PASS: TestAccShippingZone_createAndUpdateWithID (0.57s)
=== RUN TestAccShippingZone_createAndAddLocation
--- PASS: TestAccShippingZone_createAndAddLocation (0.70s)
=== RUN TestAccShippingZone_createAndRemoveLocation
--- PASS: TestAccShippingZone_createAndRemoveLocation (1.00s)
=== RUN TestAccState_createAndUpdateWithID
--- PASS: TestAccState_createAndUpdateWithID (1.58s)
=== RUN TestAccStore_createAndUpdateWithID
--- PASS: TestAccStore_createAndUpdateWithID (0.98s)
=== RUN TestAccStore_createAndUpdateDistributionLanguages
--- PASS: TestAccStore_createAndUpdateDistributionLanguages (1.17s)
=== RUN TestValidateDestination
--- PASS: TestValidateDestination (0.00s)
=== RUN TestAccSubscription_basic
--- PASS: TestAccSubscription_basic (20.04s)
=== RUN TestAccTaxCategoryRate_createAndUpdateWithID
--- PASS: TestAccTaxCategoryRate_createAndUpdateWithID (1.19s)
=== RUN TestAccTaxCategoryRate_createAndUpdateSubRates
--- PASS: TestAccTaxCategoryRate_createAndUpdateSubRates (0.85s)
=== RUN TestAccTaxCategoryRate_createAndUpdateBothRateAndTaxCategory
--- PASS: TestAccTaxCategoryRate_createAndUpdateBothRateAndTaxCategory (0.92s)
=== RUN TestAccTaxCategory_createAndUpdateWithID
--- PASS: TestAccTaxCategory_createAndUpdateWithID (0.60s)
=== RUN TestFieldTypeElement
--- PASS: TestFieldTypeElement (0.00s)
=== RUN TestResourceTypeGetFieldDefinition
--- PASS: TestResourceTypeGetFieldDefinition (0.00s)
=== RUN TestGetFieldType
--- PASS: TestGetFieldType (0.00s)
=== RUN TestAccTypes_basic
--- PASS: TestAccTypes_basic (0.41s)
=== RUN TestAccTypes_UpdateWithID
--- PASS: TestAccTypes_UpdateWithID (0.85s)
=== RUN TestCreateLookup
--- PASS: TestCreateLookup (0.00s)
FAIL
FAIL github.com/labd/terraform-provider-commercetools/commercetools 39.444s
FAIL
make: *** [testacc] Error 1
The error in TestAccCustomObjectCreate_Basic is caused by #139 . This still needs to be picked up
Results of make testacc
can still be inconsistent however, with the occasional trailing resource requiring manual deletion of created objects in commercetools to run right.
Keeping this issue open as there are still problems with acceptance tests that need some work.
from terraform-provider-commercetools.
This should work nowadays
from terraform-provider-commercetools.
Related Issues (20)
- Update to latest commercetools-go-sdk
- Wanted to quickly check if there is resource for importing products with Commercetools Terraform or any plans of introducing that. HOT 1
- Tax Category Rate Resource without State HOT 2
- Discrepancy in different CI pipeline when it comes to adding category HOT 2
- Terraform apply is failing with duplicate key issue with commercetools_product_type resource. HOT 1
- New TaxRates are being created by ignoring existing TaxRates HOT 2
- A duplicate value '"category-root-kw"' exists for field 'key'. errors getting HOT 1
- Error when using es-419 language code on localized_value (does not allow numbers) HOT 1
- dynamic values causes huge diff without real changes after upgrade HOT 1
- "invalid_client" "Please provide valid client credentials using HTTP Basic Authentication." HOT 1
- while applying terraform for update getting error HOT 1
- Can we have confluent cloud option integrated for Subscription same like Google Pub/Sub HOT 2
- Request for support for cart discount target HOT 2
- Error when trying to import shipping zone rates HOT 3
- CT project settings version mismatch HOT 2
- Allow custom api extension resource type
- How to import resources to terraform state HOT 2
- Ignore values in enums types in product type, named attributes HOT 3
- update custom fields attributes in custom types - reference object custom attribute data wiped out HOT 1
- commercetools_cart_discount to support stores HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-commercetools.