Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinvaneyk committed Jun 8, 2018
1 parent a628d3c commit 3e25f14
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
30 changes: 28 additions & 2 deletions test/integration/fission/fnenv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import (
"fmt"
"net/http"
"os"
"os/exec"
"testing"
"time"

"github.com/fission/fission"
"github.com/fission/fission-workflows/pkg/fnenv"
fissionenv "github.com/fission/fission-workflows/pkg/fnenv/fission"
"github.com/fission/fission-workflows/pkg/types"
"github.com/fission/fission-workflows/pkg/util"
"github.com/fission/fission/controller/client"
"github.com/fission/fission/crd"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
Expand All @@ -23,6 +28,9 @@ var fissionRuntime *fissionenv.FunctionEnv
var fissionResolver *fissionenv.Resolver
var resolver fnenv.Resolver

var fissionController *client.Client
var testId = util.Uid()

func TestMain(m *testing.M) {
if testing.Short() {
fmt.Println("Skipping Fission integration tests...")
Expand Down Expand Up @@ -65,12 +73,30 @@ func TestMain(m *testing.M) {
resolver = fnenv.NewMetaResolver(map[string]fnenv.RuntimeResolver{
"fission": fissionResolver,
})
// Fission Controller client: for creating and deleting functions
fissionController = client.MakeClient(fissionControllerAddr)

m.Run()
exec.Command("fission", "env", "create", "")
status := m.Run()
}

func TestFissionResolveFunction(t *testing.T) {
// TODO add actual function

metadata, err := fissionController.EnvironmentCreate(env)
if err != nil {
panic(err)
}
fn := &crd.Function{
Spec: fission.FunctionSpec{
Environment: fission.EnvironmentReference{
Namespace: ns,
},
},
}
pkg := &crd.Package{}
fissionController.PackageCreate(pkg)
fissionController.FunctionCreate(fn)

fnId, err := fissionResolver.Resolve("hello")
assert.NoError(t, err)
assert.NotEmpty(t, fnId)
Expand Down
42 changes: 42 additions & 0 deletions test/integration/fission/specs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

Fission Specs
=============

This is a set of specifications for a Fission app. This includes functions,
environments, and triggers; we collectively call these things "resources".

How to use these specs
----------------------

These specs are handled with the 'fission spec' command. See 'fission spec --help'.

'fission spec apply' will "apply" all resources specified in this directory to your
cluster. That means it checks what resources exist on your cluster, what resources are
specified in the specs directory, and reconciles the difference by creating, updating or
deleting resources on the cluster.

'fission spec apply' will also package up your source code (or compiled binaries) and
upload the archives to the cluster if needed. It uses 'ArchiveUploadSpec' resources in
this directory to figure out which files to archive.

You can use 'fission spec apply --watch' to watch for file changes and continuously keep
the cluster updated.

You can add YAMLs to this directory by writing them manually, but it's easier to generate
them. Use 'fission function create --spec' to generate a function spec,
'fission environment create --spec' to generate an environment spec, and so on.

You can edit any of the files in this directory, except 'fission-deployment-config.yaml',
which contains a UID that you should never change. To apply your changes simply use
'fission spec apply'.

fission-deployment-config.yaml
------------------------------

fission-deployment-config.yaml contains a UID. This UID is what fission uses to correlate
resources on the cluster to resources in this directory.

All resources created by 'fission spec apply' are annotated with this UID. Resources on
the cluster that are _not_ annotated with this UID are never modified or deleted by
fission.

7 changes: 7 additions & 0 deletions test/integration/fission/specs/fission-deployment-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is generated by the 'fission spec init' command.
# See the README in this directory for background and usage information.
# Do not edit the UID below: that will break 'fission spec apply'
apiVersion: fission.io/v1
kind: DeploymentConfig
name: fission
uid: 94ecbaa3-79d8-4388-8f85-52c52f9aa38f

0 comments on commit 3e25f14

Please sign in to comment.