Skip to content

Commit

Permalink
Add fixture to multiple processes
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Jul 23, 2024
1 parent c8f3dca commit 67e9f3c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/go/fixtures/multipleprocesses/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
api: api
worker: worker
31 changes: 31 additions & 0 deletions tests/go/fixtures/multipleprocesses/cmd/api/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"fmt"
"net/http"
"os"
)

func main() {
http.HandleFunc("/", hello)
http.HandleFunc("/healthcheck", healthcheck)


port := os.Getenv("PORT")
if port == "" {
port = "8888"
}

err := http.ListenAndServe(":" + port, nil)
if err != nil {
panic(err)
}
}

func hello(res http.ResponseWriter, req *http.Request) {
fmt.Fprintln(res, "hello, world!")
}

func healthcheck(res http.ResponseWriter, req *http.Request) {
fmt.Fprintln(res, "WORKING")
}
14 changes: 14 additions & 0 deletions tests/go/fixtures/multipleprocesses/cmd/worker/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main


import (
"fmt"
"time"
)

func main() {
for {
fmt.Println("worker")
time.Sleep(time.Minute)
}
}
3 changes: 3 additions & 0 deletions tests/go/fixtures/multipleprocesses/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module multipleprocesses

go 1.22.2

0 comments on commit 67e9f3c

Please sign in to comment.