Skip to content

Commit

Permalink
refactor: moving azuregc suite to the nodeclaim suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryce-Soghigian committed Feb 18, 2025
1 parent 770b2bf commit 8b63d12
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
suite: [Nonbehavioral, Utilization, GPU, Drift, Integration, NodeClaim, Chaos, ACR, AzureGarbageCollection]
suite: [Nonbehavioral, Utilization, GPU, Drift, Integration, NodeClaim, Chaos, ACR]
permissions:
contents: read
id-token: write
Expand Down
4 changes: 2 additions & 2 deletions test/pkg/environment/azure/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ func (env *Environment) ExpectCreatedInterface(networkInterface armnetwork.Inter

func (env *Environment) GetClusterSubnet() *armnetwork.Subnet {
GinkgoHelper()
vnet, err := getVNET(env.Context, env.VNETClient, env.VNETResourceGroup)
vnet, err := firstVNETInRG(env.Context, env.VNETClient, env.VNETResourceGroup)
Expect(err).ToNot(HaveOccurred())
return vnet.Properties.Subnets[0]
}

func getVNET(ctx context.Context, client *armnetwork.VirtualNetworksClient, vnetRG string) (*armnetwork.VirtualNetwork, error) {
func firstVNETInRG(ctx context.Context, client *armnetwork.VirtualNetworksClient, vnetRG string) (*armnetwork.VirtualNetwork, error) {
pager := client.NewListPager(vnetRG, nil)
for pager.More() {
resp, err := pager.NextPage(ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package azuregarbagecollection
package nodeclaim_test

import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/samber/lo"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork"
"github.com/Azure/karpenter-provider-azure/pkg/apis/v1alpha2"
azkarptest "github.com/Azure/karpenter-provider-azure/pkg/test"
"github.com/Azure/karpenter-provider-azure/test/pkg/environment/azure"
karpv1 "sigs.k8s.io/karpenter/pkg/apis/v1"
)

var env *azure.Environment
var nodeClass *v1alpha2.AKSNodeClass
var nodePool *karpv1.NodePool

func TestGC(t *testing.T) {
RegisterFailHandler(Fail)
BeforeSuite(func() {
env = azure.NewEnvironment(t)
})
RunSpecs(t, "Azure Garbage Collection")
}

var _ = BeforeEach(func() {
env.BeforeEach()
nodeClass = env.DefaultAKSNodeClass()
nodePool = env.DefaultNodePool(nodeClass)
})
var _ = AfterEach(func() { env.Cleanup() })
var _ = AfterEach(func() { env.AfterEach() })

var _ = Describe("gc", func() {
It("should garbage collect network interfaces created by karpenter", func() {
env.ExpectCreatedInterface(armnetwork.Interface{
Expand Down

0 comments on commit 8b63d12

Please sign in to comment.