-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter workspaces by current run status (#419)
- Loading branch information
1 parent
8cc4fda
commit 6372886
Showing
5 changed files
with
142 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: ENHANCEMENTS | ||
body: '`AgentPool`: The agent auroscaling logic has been updated to decrease the frequency of API calls. The controller now utilizes the List Workspaces API call with filtering based on the current run status, thereby reducing the total number of API calls needed.' | ||
time: 2024-06-12T13:23:30.219348+02:00 | ||
custom: | ||
PR: "419" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package controllers | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Helpers", Label("Unit"), func() { | ||
Context("Match wildcard name", func() { | ||
// True | ||
It("match prefix", func() { | ||
result := matchWildcardName("*-terraform-workspace", "hcp-terraform-workspace") | ||
Expect(result).To(BeTrue()) | ||
}) | ||
It("match suffix", func() { | ||
result := matchWildcardName("hcp-terraform-*", "hcp-terraform-workspace") | ||
Expect(result).To(BeTrue()) | ||
}) | ||
It("match prefix and suffix", func() { | ||
result := matchWildcardName("*-terraform-*", "hcp-terraform-workspace") | ||
Expect(result).To(BeTrue()) | ||
}) | ||
It("match no prefix and no suffix", func() { | ||
result := matchWildcardName("hcp-terraform-workspace", "hcp-terraform-workspace") | ||
Expect(result).To(BeTrue()) | ||
}) | ||
// False | ||
It("does not match prefix", func() { | ||
result := matchWildcardName("*-terraform-workspace", "hcp-tf-workspace") | ||
Expect(result).To(BeFalse()) | ||
}) | ||
It("does not match suffix", func() { | ||
result := matchWildcardName("hcp-terraform-*", "hashicorp-tf-workspace") | ||
Expect(result).To(BeFalse()) | ||
}) | ||
It("does not match prefix and suffix", func() { | ||
result := matchWildcardName("*-terraform-*", "hcp-tf-workspace") | ||
Expect(result).To(BeFalse()) | ||
}) | ||
It("does not match no prefix and no suffix", func() { | ||
result := matchWildcardName("hcp-terraform-workspace", "hcp-tf-workspace") | ||
Expect(result).To(BeFalse()) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters