fn: clean api tests: removed multi log (#801)

fn-test-utils covers this, with sleep in between.
This commit is contained in:
Tolga Ceylan
2018-02-27 21:03:03 -08:00
committed by GitHub
parent b1827b5bfb
commit 820baf36dc
7 changed files with 114 additions and 153 deletions

View File

@@ -257,51 +257,6 @@ func TestCanCauseTimeout(t *testing.T) {
DeleteApp(t, s.Context, s.Client, s.AppName)
}
func TestMultiLog(t *testing.T) {
t.Parallel()
s := SetupDefaultSuite()
routePath := "/multi-log"
image := "funcy/multi-log:0.0.1"
routeType := "sync"
CreateApp(t, s.Context, s.Client, s.AppName, map[string]string{})
CreateRoute(t, s.Context, s.Client, s.AppName, routePath, image, routeType,
s.Format, s.Timeout, s.IdleTimeout, s.RouteConfig, s.RouteHeaders)
u := url.URL{
Scheme: "http",
Host: Host(),
}
u.Path = path.Join(u.Path, "r", s.AppName, routePath)
callID := CallSync(t, u, &bytes.Buffer{})
cfg := &operations.GetAppsAppCallsCallLogParams{
Call: callID,
App: s.AppName,
Context: s.Context,
}
logObj, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
if err != nil {
t.Error(err.Error())
} else {
if logObj.Payload == "" {
t.Errorf("Log entry must not be empty!")
}
if !strings.Contains(logObj.Payload, "First line") {
t.Errorf("Log entry must contain `First line` "+
"string, but got: %v", logObj.Payload)
}
if !strings.Contains(logObj.Payload, "Second line") {
t.Errorf("Log entry must contain `Second line` "+
"string, but got: %v", logObj.Payload)
}
}
DeleteApp(t, s.Context, s.Client, s.AppName)
}
func TestCallResponseHeadersMatch(t *testing.T) {
t.Parallel()
s := SetupDefaultSuite()

View File

@@ -1,8 +0,0 @@
FROM fnproject/go:dev as build-stage
WORKDIR /function
ADD . /src
RUN cd /src && go build -o func
FROM fnproject/go
WORKDIR /function
COPY --from=build-stage /src/func /function/
ENTRYPOINT ["./func"]

View File

@@ -1,5 +0,0 @@
name: fnproject/multi-log
version: 0.0.1
runtime: go
entrypoint: ./func
path: /multi-log

View File

@@ -1,14 +0,0 @@
package main
import (
"fmt"
"os"
"time"
)
func main() {
fmt.Fprintln(os.Stderr, "First line")
fmt.Fprintln(os.Stdout, "Ok")
time.Sleep(3 * time.Second)
fmt.Fprintln(os.Stderr, "Second line")
}