Skip to content

Commit

Permalink
Fix webhook URL in tests (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
arybolovlev authored Oct 29, 2024
1 parent 07ec203 commit 020369a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ var secretNamespacedName = types.NamespacedName{

var rndm = rand.New(rand.NewSource(GinkgoRandomSeed()))

// TODO:
// - Find a different way to create an ephemeral webhook URL as a more reliable solution.
// Perhaps, use smee client to create a new channel per test run.
var webhookURL = "https://smee.io/PZeBPogfii2vPl6s"

func TestControllersAPIs(t *testing.T) {
RegisterFailHandler(Fail)

Expand Down
6 changes: 3 additions & 3 deletions controllers/workspace_controller_notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var _ = Describe("Workspace controller", Ordered, func() {
instance.Spec.Notifications = append(instance.Spec.Notifications, appv1alpha2.Notification{
Name: "slack",
Type: tfc.NotificationDestinationTypeSlack,
URL: "https://www.hashicorp.com",
URL: webhookURL,
})
// Create a new Kubernetes workspace object and wait until the controller finishes the reconciliation
createWorkspace(instance)
Expand All @@ -101,7 +101,7 @@ var _ = Describe("Workspace controller", Ordered, func() {
instance.Spec.Notifications = append(instance.Spec.Notifications, appv1alpha2.Notification{
Name: "slack",
Type: tfc.NotificationDestinationTypeSlack,
URL: "https://www.hashicorp.com",
URL: webhookURL,
})
instance.Spec.Notifications = append(instance.Spec.Notifications, appv1alpha2.Notification{
Name: "email",
Expand All @@ -121,7 +121,7 @@ var _ = Describe("Workspace controller", Ordered, func() {
instance.Spec.Notifications = append(instance.Spec.Notifications, appv1alpha2.Notification{
Name: "slack",
Type: tfc.NotificationDestinationTypeSlack,
URL: "https://www.hashicorp.com",
URL: webhookURL,
})
// Create a new Kubernetes workspace object and wait until the controller finishes the reconciliation
createWorkspace(instance)
Expand Down
2 changes: 1 addition & 1 deletion controllers/workspace_controller_run_tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func isRunTasksReconciled(instance *appv1alpha2.Workspace) {
func createRunTaskForTest(name string) string {
rt, err := tfClient.RunTasks.Create(ctx, organization, tfc.RunTaskCreateOptions{
Name: name,
URL: "https://www.hashicorp.com",
URL: webhookURL,
Category: "task", // MUST BE "task"
Enabled: tfc.Bool(true),
})
Expand Down

0 comments on commit 020369a

Please sign in to comment.