Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = Describe("Config", func() {
"log_level_port": 9090
}`)
parsedConfig, err = NewConfig(configJSON)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})

It("contains the values in the JSON", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var _ = Describe("GetIP", func() {
Context("when requesting anything but an A record", func() {
It("should return a successful response with no answers", func() {
request, err := http.NewRequest("GET", "?type=16&name=app-id.internal.local.", nil)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

getIP.ServeHTTP(resp, request)

Expand Down
34 changes: 17 additions & 17 deletions src/code.cloudfoundry.org/bosh-dns-adapter/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ var _ = Describe("Main", func() {
)

tempConfigFile, err = os.CreateTemp(os.TempDir(), "sd")
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
_, err = tempConfigFile.Write([]byte(configFileContents))
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

startCmd := exec.Command(pathToServer, "-c", tempConfigFile.Name())
session, err = gexec.Start(startCmd, GinkgoWriter, GinkgoWriter)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})

AfterEach(func() {
Expand Down Expand Up @@ -227,7 +227,7 @@ var _ = Describe("Main", func() {
startCmd := exec.Command(pathToServer, "-c", tempConfigFile.Name())
var err error
session2, err = gexec.Start(startCmd, GinkgoWriter, GinkgoWriter)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})

AfterEach(func() {
Expand Down Expand Up @@ -338,7 +338,7 @@ var _ = Describe("Main", func() {
startCmd := exec.Command(pathToServer, "-c", "/non-existent-path")
var err error
session2, err = gexec.Start(startCmd, GinkgoWriter, GinkgoWriter)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})

AfterEach(func() {
Expand Down Expand Up @@ -370,7 +370,7 @@ var _ = Describe("Main", func() {
startCmd := exec.Command(pathToServer)
var err error
session2, err = gexec.Start(startCmd, GinkgoWriter, GinkgoWriter)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})

AfterEach(func() {
Expand All @@ -387,15 +387,15 @@ var _ = Describe("Main", func() {
Eventually(session).Should(gbytes.Say("bosh-dns-adapter.server-started"))
url := fmt.Sprintf("http://127.0.0.1:%s?type=16&name=app-id.internal.local.", dnsAdapterPort)
request, err := http.NewRequest("GET", url, nil)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

resp, err := http.DefaultClient.Do(request)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

Expect(resp.StatusCode).To(Equal(http.StatusOK))

all, err := io.ReadAll(resp.Body)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

Expect(string(all)).To(MatchJSON(`{
"Status": 0,
Expand Down Expand Up @@ -560,22 +560,22 @@ var _ = Describe("Main", func() {
It("logs at info level by default", func() {
url := fmt.Sprintf("http://127.0.0.1:%s?type=1&name=app-id.internal.local.", dnsAdapterPort)
request, err := http.NewRequest("GET", url, nil)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
resp, err := http.DefaultClient.Do(request)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
Expect(resp.StatusCode).To(Equal(200))

Expect(session).ToNot(gbytes.Say("bosh-dns-adapter.serve-request"))
Expect(session).NotTo(gbytes.Say("bosh-dns-adapter.serve-request"))
})

It("logs at debug level when configured", func() {
requestLogChange("debug", logLevelPort)

url := fmt.Sprintf("http://127.0.0.1:%s?type=1&name=app-id.internal.local.", dnsAdapterPort)
request, err := http.NewRequest("GET", url, nil)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
resp, err := http.DefaultClient.Do(request)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
Expect(resp.StatusCode).To(Equal(200))

Eventually(session).Should(gbytes.Say("bosh-dns-adapter.serve-request"))
Expand All @@ -588,15 +588,15 @@ func requestLogChange(logLevel string, port int) *http.Response {
postBody := strings.NewReader(logLevel)
url := fmt.Sprintf("http://localhost:%d/log-level", port)
response, err := client.Post(url, "text/plain", postBody)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
return response
}

func makeDNSRequest(url string, expectedResponseCode int) {
request, err := http.NewRequest("GET", url, nil)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
resp, err := http.DefaultClient.Do(request)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
Expect(resp.StatusCode).To(Equal(expectedResponseCode))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var _ = Describe("ServiceDiscoveryClient", func() {

It("returns the ips in the server response", func() {
actualIPs, err := client.IPs("app-id.apps.internal.")
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

Expect(actualIPs).To(ConsistOf("192.168.0.1", "192.168.0.2"))
})
Expand Down Expand Up @@ -168,14 +168,14 @@ var _ = Describe("ServiceDiscoveryClient", func() {
}],
"service": ""
}`))
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})
})

It("shuffles them to return them in random order", func() {
Eventually(func() []string {
ips, err := client.IPs("app-id.apps.internal.")
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
return ips
}).Should(Equal([]string{"192.168.0.3", "192.168.0.1", "192.168.0.2"}))
})
Expand Down Expand Up @@ -238,7 +238,7 @@ var _ = Describe("ServiceDiscoveryClient", func() {
It("retries and returns the successful response", func() {
startTime := time.Now()
actualIPs, err := client.IPs("app-id.apps.internal.")
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

Expect(actualIPs).To(ConsistOf("192.168.0.1", "192.168.0.2"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var _ = Describe("Provider", func() {
})

It("returns a parsable IP", func() {
Expect(net.ParseIP(provider.Get("a-hostname.apps.internal"))).ToNot(BeNil())
Expect(net.ParseIP(provider.Get("a-hostname.apps.internal"))).NotTo(BeNil())
})

Specify("the same hostname always returns the same VIP", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ = Describe("Garden External Networker errors", func() {
Expect(configFile.Close()).To(Succeed())

dir, err := os.MkdirTemp("", "fake-cni-dir")
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

stateFilePath, err := os.CreateTemp("", "external-networker-state.json")
Expect(err).NotTo(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ var _ = Describe("Garden External Networker", func() {
cniPluginNames := []string{"plugin-0", "plugin-1", "plugin-2", "plugin-3"}
for _, name := range cniPluginNames {
err = link(paths.PathToFakeCNIPlugin, filepath.Join(cniPluginDir, name))
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
}

config = map[string]interface{}{
Expand Down Expand Up @@ -461,7 +461,7 @@ func runAndWait(cmd *exec.Cmd) *gexec.Session {

func createNetworkNamespace() ns.NetNS {
networkNS, err := nstestutils.NewNS()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
return networkNS
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ var _ = Describe("ASGSyncer", func() {
})
It("doesn't return an error", func() {
err := asgSyncer.Poll()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})
It("doesn't update the database", func() {
asgSyncer.Poll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var _ = Describe("Authentication middleware", func() {
unprotectedCallCount += 1
By("passing the token data to the unprotected request")
data := r.Context().Value(handlers.TokenDataKey)
Expect(data).ToNot(BeNil())
Expect(data).NotTo(BeNil())
Expect(data).To(Equal(tokenResponse))

Expect(w).To(Equal(resp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var _ = Describe("Create Tags API", func() {
It("creates a new tag", func() {
Expect(resp.StatusCode).To(Equal(http.StatusOK))
responseBody, err := io.ReadAll(resp.Body)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
Expect(string(responseBody)).To(MatchJSON(`{"type":"router-type","id":"router-guid","tag":"0001"}`))
})

Expand All @@ -89,7 +89,7 @@ var _ = Describe("Create Tags API", func() {
It("returns the same tag", func() {
Expect(resp.StatusCode).To(Equal(http.StatusOK))
responseBody, err := io.ReadAll(resp.Body)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
Expect(string(responseBody)).To(MatchJSON(`{"type":"router-type","id":"router-guid","tag":"0001"}`))
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func assertMigrationsSucceeded(conn *db.ConnWrapper, conf config.Config) {
if conn.DriverName() == "mysql" {
var version string
err := conn.QueryRow("SELECT VERSION()").Scan(&version)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
}

var migrationCount int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func migrateAndPopulateTags(dbConf db.Config) {
},
}
_, err = migrator.PerformMigrations(realDb.DriverName(), realDb, 0)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

tagPopulator := &store.TagPopulator{DBConnection: realDb}
err = tagPopulator.PopulateTables(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var _ = Describe("Migrations Provider", func() {

It("returns a list of migrations to perform", func() {
migrationsToPerform, err := migrationsProvider.MigrationsToPerform()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
expectedMigrations := migrations.PolicyServerMigrations{
migrations.V1ModifiedMigrationsToPerform[0],
migrations.V1ModifiedMigrationsToPerform[1],
Expand Down Expand Up @@ -73,7 +73,7 @@ var _ = Describe("Migrations Provider", func() {

It("returns a legacy v1 migration in the list of migrations to perform", func() {
migrationsToPerform, err := migrationsProvider.MigrationsToPerform()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
expectedMigrations := migrations.PolicyServerMigrations{
migrations.V1LegacyMigrationsToPerform[0],
migrations.V1LegacyMigrationsToPerform[1],
Expand All @@ -100,7 +100,7 @@ var _ = Describe("Migrations Provider", func() {

It("returns a legacy v2 migration in the list of migrations to perform", func() {
migrationsToPerform, err := migrationsProvider.MigrationsToPerform()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
expectedMigrations := migrations.PolicyServerMigrations{
migrations.V2LegacyMigrationsToPerform[0],
migrations.V2LegacyMigrationsToPerform[1],
Expand All @@ -124,7 +124,7 @@ var _ = Describe("Migrations Provider", func() {

It("returns a legacy v3 migration in the list of migrations to perform", func() {
migrationsToPerform, err := migrationsProvider.MigrationsToPerform()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
expectedMigrations := migrations.PolicyServerMigrations{
migrations.V3LegacyMigrationsToPerform[0],
migrations.V3LegacyMigrationsToPerform[1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2014,12 +2014,12 @@ var _ = Describe("migrations", func() {
var guids []string
for range 149 {
guid, err := uuid.NewV4()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
guids = append(guids, guid.String())
}
array, err := json.Marshal(guids)
spacesJson = string(array)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())
})
It("no longer adds indices", func() {
By("performing migration")
Expand Down Expand Up @@ -2625,15 +2625,15 @@ type JoinRow struct {

func ExpectAssociatedSpacesToConsistOf(realDb *db.ConnWrapper, table string, expectedRows []JoinRow) {
rows, err := realDb.Query(fmt.Sprintf("SELECT security_group_guid, space_guid FROM %s_security_groups_spaces", table))
ExpectWithOffset(1, err).ToNot(HaveOccurred())
ExpectWithOffset(1, err).NotTo(HaveOccurred())
if len(expectedRows) == 0 {
ExpectWithOffset(1, scanCountRow(rows)).To(Equal(0))
} else {
var receivedRows []JoinRow
for rows.Next() {
var sg, space string
err := rows.Scan(&sg, &space)
ExpectWithOffset(1, err).ToNot(HaveOccurred())
ExpectWithOffset(1, err).NotTo(HaveOccurred())
receivedRows = append(receivedRows, JoinRow{
SecurityGroup: sg,
Space: space,
Expand Down
Loading
Loading