Skip to content

Commit

Permalink
Format the yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewuolle committed Nov 30, 2024
1 parent 17231b6 commit fe0a5e9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/e2e/managedcluster/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
package aws

import (
"bytes"
"bufio"
"context"
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -65,14 +67,14 @@ func PopulateHostedTemplateVars(ctx context.Context, kc *kubeclient.KubeClient,
"id": subnet["resourceID"],
}
}

buf := bytes.Buffer{}
enc := yaml.NewEncoder(&buf)
enc.SetIndent(5)
err = enc.Encode(&subnetMaps)
var subnetsFormatted string
encodedYaml, err := yaml.Marshal(subnetMaps)
Expect(err).NotTo(HaveOccurred(), "failed to get marshall subnet maps")
subnetYaml := buf.String()
GinkgoT().Setenv(managedcluster.EnvVarAWSSubnets, subnetYaml)
scanner := bufio.NewScanner(strings.NewReader(string(encodedYaml)))
for scanner.Scan() {
subnetsFormatted += fmt.Sprintf(" %s\n", scanner.Text())
}
GinkgoT().Setenv(managedcluster.EnvVarAWSSubnets, subnetsFormatted)

securityGroupID, found, err := unstructured.NestedString(
awsCluster.Object, "status", "networkStatus", "securityGroups", "node", "id")
Expand Down

0 comments on commit fe0a5e9

Please sign in to comment.