mirror of https://github.com/knative/func.git
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
//go:build !integration
|
|
// +build !integration
|
|
|
|
package docker_test
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
fn "knative.dev/kn-plugin-func"
|
|
"knative.dev/kn-plugin-func/docker"
|
|
)
|
|
|
|
// Docker Run Integraiton Test
|
|
// This is an integraiton test meant to be manually run in order to confirm proper functioning of the docker runner.
|
|
// It requires that the function already be built.
|
|
|
|
var enableTestDocker = flag.Bool("enable-test-docker", false, "Enable tests requiring local docker.")
|
|
|
|
func TestDockerRun(t *testing.T) {
|
|
// Skip this test unless explicitly enabled, as it is more of
|
|
// an integration test.
|
|
if !*enableTestDocker {
|
|
fmt.Fprintln(os.Stdout, "Skipping docker integration test for 'run'. Enable with --enable-test-docker")
|
|
t.Skip()
|
|
}
|
|
|
|
f, err := fn.NewFunction("testdata/example.com/runnable")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// TODO: This test is too tricky, as it requires the related image be
|
|
// already built. Build the function prior to running?
|
|
|
|
runner := docker.NewRunner()
|
|
runner.Verbose = true
|
|
if err = runner.Run(context.Background(), f); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
/* TODO
|
|
// submit cloud event
|
|
// send os.SIGUSR1 in leay of SIGTERM
|
|
*/
|
|
|
|
}
|