forked from cloudfoundry/cf-networking-release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbig_asg_test.go
77 lines (65 loc) · 2.05 KB
/
big_asg_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package acceptance_test
import (
"fmt"
"math/rand"
"os"
"time"
"code.cloudfoundry.org/lib/testsupport"
"github.com/cloudfoundry/cf-test-helpers/v2/cf"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("Container startup time with a big ASG", func() {
var (
orgName string
spaceName string
ASGFilepath string
)
BeforeEach(func() {
AuthAsAdmin()
orgName = "asg-org"
Expect(cfCLI.CreateOrg(orgName)).To(Succeed())
Expect(cfCLI.TargetOrg(orgName)).To(Succeed())
spaceName = "asg-space"
Expect(cfCLI.CreateSpace(spaceName, orgName)).To(Succeed())
Expect(cfCLI.TargetSpace(spaceName)).To(Succeed())
})
AfterEach(func() {
Expect(cf.Cf("delete-org", orgName, "-f").Wait(Timeout_Push)).To(gexec.Exit(0))
Expect(cfCLI.DeleteSecurityGroup("big-asg")).To(Succeed())
os.Remove(ASGFilepath)
})
Describe("Pushing app with and without a large application security group (ASG)", func() {
It("should not give large time difference", func() {
var (
durationWithoutASG time.Duration
durationWithASG time.Duration
)
By("pushing an app", func() {
start := time.Now()
appB := fmt.Sprintf("appB-%d", rand.Int31())
pushProxy(appB)
durationWithoutASG = time.Since(start)
})
By("creating a large ASG", func() {
asg := testsupport.BuildASG(1000)
var err error
ASGFilepath, err = testsupport.CreateTempFile(asg)
Expect(err).NotTo(HaveOccurred())
Expect(cfCLI.CreateSecurityGroup("big-asg", ASGFilepath)).To(Succeed())
Expect(cfCLI.BindSecurityGroup("big-asg", orgName, spaceName)).To(Succeed())
})
By("pushing another app", func() {
start := time.Now()
appA := fmt.Sprintf("appA-%d", rand.Int31())
pushProxy(appA)
durationWithASG = time.Since(start)
})
fmt.Println("##############################################")
fmt.Println("push app without ASG took:", durationWithoutASG)
fmt.Println("push app with big ASG took:", durationWithASG)
fmt.Println("##############################################")
})
})
})