Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove support for CF CLI v7 #924

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions acceptance-tests/helpers/cf/version.go

This file was deleted.

31 changes: 0 additions & 31 deletions acceptance-tests/helpers/servicekeys/get.go

This file was deleted.

32 changes: 3 additions & 29 deletions acceptance-tests/helpers/services/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func CreateInstance(offering, plan string, opts ...Option) *ServiceInstance {
cfg := defaultConfig(offering, plan, opts...)
args := []string{
"create-service",
"--wait",
offering,
plan,
cfg.name,
Expand All @@ -40,34 +41,13 @@ func CreateInstance(offering, plan string, opts ...Option) *ServiceInstance {
args = append(args, "-c", cfg.parameters)
}

switch cf.Version() {
case cf.VersionV8:
createInstanceWithWait(cfg.name, args)
default:
createInstanceWithPoll(cfg.name, args)
}

return &ServiceInstance{Name: cfg.name}
}

func createInstanceWithWait(name string, args []string) {
args = append(args, "--wait")
session := cf.Start(args...)
Eventually(session).WithTimeout(operationTimeout).Should(Exit(0), func() string {
out, _ := cf.Run("service", name)
out, _ := cf.Run("service", cfg.name)
return out
})
}

func createInstanceWithPoll(name string, args []string) {
session := cf.Start(args...)
Eventually(session).WithTimeout(asyncCommandTimeout).Should(Exit(0))

Eventually(func() string {
out, _ := cf.Run("service", name)
Expect(out).NotTo(MatchRegexp(`status:\s+create failed`))
return out
}).WithTimeout(operationTimeout).WithPolling(pollingInterval).Should(MatchRegexp(`status:\s+create succeeded`))
return &ServiceInstance{Name: cfg.name}
}

func WithDefaultBroker() Option {
Expand All @@ -76,12 +56,6 @@ func WithDefaultBroker() Option {
}
}

func WithMASBBroker() Option {
return func(c *config) {
c.serviceBrokerName = func() string { return "azure-service-broker" }
}
}

func WithBroker(broker *brokers.Broker) Option {
return func(c *config) {
c.serviceBrokerName = func() string { return broker.Name }
Expand Down
18 changes: 0 additions & 18 deletions acceptance-tests/helpers/services/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,10 @@ func (s *ServiceInstance) Delete() {
}

func Delete(name string) {
switch cf.Version() {
case cf.VersionV8:
deleteWithWait(name)
default:
deleteWithPoll(name)
}
}

func deleteWithWait(name string) {
session := cf.Start("delete-service", "-f", name, "--wait")
Eventually(session).WithTimeout(operationTimeout).Should(Exit(0))
}

func deleteWithPoll(name string) {
cf.Run("delete-service", "-f", name)

Eventually(func() string {
out, _ := cf.Run("services")
return out
}).WithTimeout(operationTimeout).WithPolling(pollingInterval).ShouldNot(ContainSubstring(name))
}

func (s *ServiceInstance) Purge() {
cf.Run("purge-service-instance", "-f", s.Name)
}
6 changes: 1 addition & 5 deletions acceptance-tests/helpers/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ package services

import "time"

const (
asyncCommandTimeout = 5 * time.Minute
operationTimeout = time.Hour
pollingInterval = 10 * time.Second
)
const operationTimeout = time.Hour
22 changes: 0 additions & 22 deletions acceptance-tests/helpers/services/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ import (
)

func (s *ServiceInstance) Update(parameters ...string) {
switch cf.Version() {
case cf.VersionV8:
s.updateServiceWithWait(parameters...)
default:
s.updateServiceWithPoll(parameters...)
}
}

func (s *ServiceInstance) updateServiceWithWait(parameters ...string) {
args := append([]string{"update-service", s.Name, "--wait"}, parameters...)

session := cf.Start(args...)
Expand All @@ -25,16 +16,3 @@ func (s *ServiceInstance) updateServiceWithWait(parameters ...string) {
return out
})
}

func (s *ServiceInstance) updateServiceWithPoll(parameters ...string) {
args := append([]string{"update-service", s.Name}, parameters...)

session := cf.Start(args...)
Eventually(session).WithTimeout(asyncCommandTimeout).Should(Exit(0))

Eventually(func() string {
out, _ := cf.Run("service", s.Name)
Expect(out).NotTo(MatchRegexp(`status:\s+update failed`))
return out
}).WithTimeout(operationTimeout).WithPolling(pollingInterval).Should(MatchRegexp(`status:\s+update succeeded`))
}
7 changes: 5 additions & 2 deletions acceptance-tests/helpers/services/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ func (s *ServiceInstance) Upgrade() {
}

session := cf.Start("upgrade-service", s.Name, "--force", "--wait")
Eventually(session).WithTimeout(asyncCommandTimeout).Should(Exit(0))
Eventually(session).WithTimeout(operationTimeout).Should(Exit(0), func() string {
out, _ := cf.Run("service", s.Name)
return out
})

out, _ := cf.Run("service", s.Name)
Expect(out).To(MatchRegexp(`status:\s+update succeeded`))
Expand All @@ -40,7 +43,7 @@ func (s *ServiceInstance) UpgradeExpectFailure() {
Expect(s.UpgradeAvailable()).To(BeTrue(), "service instance does not have an upgrade available")

session := cf.Start("upgrade-service", s.Name, "--force", "--wait")
Eventually(session).WithTimeout(asyncCommandTimeout).Should(Exit())
Eventually(session).WithTimeout(operationTimeout).Should(Exit())

out, _ := cf.Run("service", s.Name)
Expect(out).To(MatchRegexp(`status:\s+update failed`))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

var _ = Describe("Upgrade and Update csb-azure-mssql-db-failover-group 'existing' plan", Label("mssql-db-failover-group-existing"), func() {
When("upgrading broker version", Label("modern"), func() {
When("upgrading broker version", func() {

It("should continue to work", func() {
ctx := context.Background()
Expand Down
Loading