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

fix(sdk): cloud.Service test when using tf-aws target #7233

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

marciocadev
Copy link
Collaborator

@marciocadev marciocadev commented Jan 5, 2025

I try to run this test whit the command wing test --platform tf-aws minimal.test.w

bring cloud;

let s = new cloud.Service(inflight () => {
  log("hello, service!");

  return () => {
    log("stopping!");
  };
});

test "start and stop" {
  assert(s.started());
  s.stop();
  assert(!s.started());
}

but I get this error

$ wing test --platform tf-aws minimal.test.w
✔ Compiling minimal.test.w to tf-aws...

✔ terraform init

✖ terraform apply

Command failed: terraform apply -auto-approve
╷
│ Error: creating ECS Cluster (Test.mfet8zI2Z4_cluster): InvalidParameterException: Cluster name must match ^[a-zA-Z0-9\-_]{1,255}$, but was Test.mfet8zI2Z4_cluster
│
│   with aws_ecs_cluster.Testmfet8zI2Z4_env0_Service_ECSCluster_1D77BD98,
│   on main.tf.json line 116, in resource.aws_ecs_cluster.Testmfet8zI2Z4_env0_Service_ECSCluster_1D77BD98:
│  116:       }
│
╵

✔ terraform destroy


Tests 1 failed (1)
Snapshots 1 skipped
Test Files 1 failed (1)
Duration 3m29.12s

When objects are generated for the test, the default is to generate the cluster name like this Test.mfet8zI2Z4_cluster.
However, the cluster name cannot have a ., so I made a small adjustment to replace . with _ to avoid this error

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@marciocadev marciocadev marked this pull request as ready for review January 5, 2025 15:25
@marciocadev marciocadev requested a review from a team as a code owner January 5, 2025 15:25
Copy link

github-actions bot commented Jan 5, 2025

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistance, don't hesitate to ping use over Discord.

@marciocadev marciocadev requested a review from eladb January 5, 2025 20:52
@skyrpex
Copy link
Contributor

skyrpex commented Jan 7, 2025

Thanks :)

Copy link
Contributor

mergify bot commented Jan 7, 2025

Thanks for contributing, @marciocadev! This PR will now be added to the merge queue, or immediately merged if fix-tfaws-service-tests is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit c10997b into winglang:main Jan 7, 2025
13 checks passed
Copy link
Contributor

mergify bot commented Jan 7, 2025

Thanks for contributing, @marciocadev! This PR will now be added to the merge queue, or immediately merged if fix-tfaws-service-tests is up-to-date with main and the queue is empty.

@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.85.42.

1 similar comment
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.85.42.

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.

3 participants