Skip to content

Commit

Permalink
Merge branch 'cloudfoundry:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
renelehmann authored Nov 29, 2024
2 parents 162c8f8 + f4c9a7f commit beb7cfb
Show file tree
Hide file tree
Showing 398 changed files with 4,757 additions and 3,593 deletions.
148 changes: 27 additions & 121 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,146 +1,52 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/catnip"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/credhub-service-broker"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/go_calls_ruby"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/golang"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/grpc"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/http2"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/logging-route-service"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/pora"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/proxy"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/syslog-drain-listener"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/tcp-listener"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/assets/worker"
target-branch: "develop"
schedule:
interval: "daily"
interval: "weekly"
directories:
- "/"
- "/assets/catnip"
- "/assets/credhub-service-broker"
- "/assets/go_calls_ruby"
- "/assets/golang"
- "/assets/grpc"
- "/assets/http2"
- "/assets/logging-route-service"
- "/assets/pora"
- "/assets/proxy"
- "/assets/syslog-drain-listener"
- "/assets/tcp-listener"
- "/assets/worker"

- package-ecosystem: "docker"
directory: "/assets/pora"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "bundler"
vendor: true
directory: "/assets/dora"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "bundler"
vendor: true
directory: "/assets/go_calls_ruby"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "bundler"
vendor: true
directory: "/assets/hello-routing"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "bundler"
vendor: true
directory: "/assets/hello-world"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "bundler"
vendor: true
directory: "/assets/loggregator-load-generator"
target-branch: "develop"
schedule:
interval: "daily"

- package-ecosystem: "bundler"
vendor: true
directory: "/assets/ruby_simple"
target-branch: "develop"
schedule:
interval: "daily"
interval: "weekly"

- package-ecosystem: "bundler"
vendor: true
directory: "/assets/service_broker"
target-branch: "develop"
schedule:
interval: "daily"
interval: "weekly"
directories:
- "/assets/dora"
- "/assets/go_calls_ruby"
- "/assets/hello-routing"
- "/assets/hello-world"
- "/assets/loggregator-load-generator"
- "/assets/ruby_simple"
- "/assets/service_broker"

- package-ecosystem: "maven"
directory: "/assets/java-spring"
target-branch: "develop"
schedule:
interval: "daily"
interval: "weekly"

- package-ecosystem: "gradle"
directory: "/assets/credhub-enabled-app"
target-branch: "develop"
schedule:
interval: "daily"
interval: "weekly"
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ include_app_syslog_tcp
* `private_docker_registry_password`: Password to access the private docker repository. [See below](#private-docker)
* `unallocated_ip_for_security_group`: An unused IP address in the private network used by CF. Defaults to 10.0.244.255. [See below](#container-networking-and-application-security-groups)

* `require_proxied_app_traffic`: Set this to `true` if Diego was configured to require proxied port mappings, i.e. if `containers.proxy.enable_unproxied_port_mappings` is set to `false`.

* `staticfile_buildpack_name` [See below](#buildpack-names)
* `java_buildpack_name` [See below](#buildpack-names)
* `ruby_buildpack_name` [See below](#buildpack-names)
Expand All @@ -188,6 +186,7 @@ include_app_syslog_tcp
* `volume_service_name`: The name of the volume service provided by the volume service broker.
* `volume_service_plan_name`: The name of the plan of the service provided by the volume service broker.
* `volume_service_create_config`: The JSON configuration that is used when volume service is created.
* `volume_service_bind_config`: The JSON configuration for the volume service binding configuration.

#### Buildpack Names
Many tests specify a buildpack when pushing an app, so that on diego the app staging process completes in less time. The default names for the buildpacks are as follows; if you have buildpacks with different names, you can override them by setting different names:
Expand Down
68 changes: 63 additions & 5 deletions apps/crashing.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,47 @@
package apps

import (
"encoding/json"
"fmt"
. "github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"

"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
"github.com/cloudfoundry/cf-test-helpers/v2/cf"
"github.com/cloudfoundry/cf-test-helpers/v2/helpers"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
"time"
)

func hasOneInstanceInState(processPath, desiredState string) bool {
// Perform the CF curl command to get process stats
session := cf.Cf("curl", processPath).Wait()

// Parse the JSON response
instancesJson := struct {
Resources []struct {
Type string `json:"type"`
State string `json:"state"`
} `json:"resources"`
}{}

// Read the session output and unmarshal the JSON data
bytes := session.Wait().Out.Contents()
err := json.Unmarshal(bytes, &instancesJson)
Expect(err).ToNot(HaveOccurred(), "Error unmarshalling process stats JSON")

// Check if any instance is in the desired state
for _, instance := range instancesJson.Resources {
if instance.State == desiredState {
return true
}
}
return false
}

var _ = AppsDescribe("Crashing", func() {
var appName string

Expand Down Expand Up @@ -45,6 +73,36 @@ var _ = AppsDescribe("Crashing", func() {
})
})

Describe("an app with three instances, two running and one crashing", func() {
It("keeps two instances running while another crashes", func() {
By("Pushing the app with three instances")
Expect(cf.Cf(
"push", appName,
"-b", "python_buildpack",
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().PythonCrashApp,
"-i", "3", // Setting three instances
).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))

By("Checking that the app is up and running")
Eventually(cf.Cf("app", appName)).Should(Say("running"))

By("Waiting until one instance crashes")
appGuid := app_helpers.GetAppGuid(appName)
processStatsPath := fmt.Sprintf("/v3/apps/%s/processes/web/stats", appGuid)

// Poll until at least one instance has crashed
Eventually(func() bool {
return hasOneInstanceInState(processStatsPath, "CRASHED")
}, 60*time.Second, 5*time.Second).Should(BeTrue(), "At least one instance should be in the CRASHED state")

By("Verifying at least one instance is still running")
foundRunning := hasOneInstanceInState(processStatsPath, "RUNNING")
Expect(foundRunning).To(BeTrue(), "At least one instance should still be in the RUNNING state")

})
})

Context("the app crashes", func() {
BeforeEach(func() {
Expect(cf.Cf(app_helpers.CatnipWithArgs(
Expand Down
15 changes: 5 additions & 10 deletions apps/default_environment_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,11 @@ exit 1
"VCAP_APP_PORT",
)

if Config.GetRequireProxiedAppTraffic() {
assertNotPresent(env,
"CF_INSTANCE_ADDR",
"CF_INSTANCE_PORT",
)
} else {
assertPresent(env,
"CF_INSTANCE_ADDR",
"CF_INSTANCE_PORT",
)
if v, ok := env["CF_INSTANCE_PORT"]; ok && v != "" {
Expect(v).To(MatchRegexp(`[0-9]+`))
}
if v, ok := env["CF_INSTANCE_ADDR"]; ok && v != "" {
Expect(v).To(MatchRegexp(`[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+`))
}

if Config.GetIncludeTasks() {
Expand Down
4 changes: 1 addition & 3 deletions apps/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,10 @@ var _ = AppsDescribe("Application Lifecycle", func() {
Expect(len(ports)).NotTo(BeZero())
Expect(ports[0].Internal).NotTo(BeZero())

if Config.GetRequireProxiedAppTraffic() {
Expect(ports[0].External).To(BeNil())
if ports[0].External == nil {
Expect(envValues.Port).To(BeZero())
Expect(envValues.Addr).To(BeZero())
} else {
Expect(ports[0].External).NotTo(BeNil())
Expect(*ports[0].External).NotTo(BeZero())
Expect(envValues.Port).To(MatchRegexp(`[0-9]+`))
Expect(envValues.Addr).To(MatchRegexp(`[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+`))
Expand Down
54 changes: 0 additions & 54 deletions apps/routing_transparency.go

This file was deleted.

10 changes: 7 additions & 3 deletions assets/binary/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ func main() {
http.HandleFunc("/", hello)
http.HandleFunc("/env", env)
fmt.Println("listening...")
err := http.ListenAndServe(":"+os.Getenv("PORT"), nil)
server := &http.Server{
Addr: fmt.Sprintf(":%s", os.Getenv("PORT")),
Handler: nil,
}
err := server.ListenAndServe()
if err != nil {
panic(err)
}
}

func hello(res http.ResponseWriter, req *http.Request) {
func hello(res http.ResponseWriter, _ *http.Request) {
fmt.Fprintln(res, "Hello from a binary")
}

func env(res http.ResponseWriter, req *http.Request) {
func env(res http.ResponseWriter, _ *http.Request) {
envVariables := make(map[string]string)
for _, envKeyValue := range os.Environ() {
keyValue := strings.Split(envKeyValue, "=")
Expand Down
Loading

0 comments on commit beb7cfb

Please sign in to comment.