src: rename bosonFunc fn

This commit is contained in:
Luke Kingland 2021-06-21 21:44:28 +09:00
parent 8fb99a37af
commit 5ded87368b
No known key found for this signature in database
GPG Key ID: 4896F75BAF2E1966
25 changed files with 220 additions and 220 deletions

View File

@ -27,7 +27,7 @@ import (
dockerClient "github.com/docker/docker/client"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
//Builder holds the configuration that will be passed to
@ -54,7 +54,7 @@ var RuntimeToBuildpack = map[string]string{
}
// Build the Function at path.
func (builder *Builder) Build(ctx context.Context, f bosonFunc.Function) (err error) {
func (builder *Builder) Build(ctx context.Context, f fn.Function) (err error) {
// Use the builder found in the Function configuration file
// If one isn't found, use the defaults

View File

@ -11,7 +11,7 @@ import (
"path/filepath"
"testing"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/mock"
)
@ -35,10 +35,10 @@ func TestNew(t *testing.T) {
defer using(t, root)()
// New Client
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
client := fn.New(fn.WithRegistry(TestRegistry))
// New Function using Client
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
}
@ -48,14 +48,14 @@ func TestTemplateWrites(t *testing.T) {
root := "testdata/example.com/testCreateWrites"
defer using(t, root)()
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
if err := client.Create(bosonFunc.Function{Root: root}); err != nil {
client := fn.New(fn.WithRegistry(TestRegistry))
if err := client.Create(fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
// Assert file was written
if _, err := os.Stat(filepath.Join(root, bosonFunc.ConfigFile)); os.IsNotExist(err) {
t.Fatalf("Initialize did not result in '%v' being written to '%v'", bosonFunc.ConfigFile, root)
if _, err := os.Stat(filepath.Join(root, fn.ConfigFile)); os.IsNotExist(err) {
t.Fatalf("Initialize did not result in '%v' being written to '%v'", fn.ConfigFile, root)
}
}
@ -66,13 +66,13 @@ func TestExtantAborts(t *testing.T) {
defer using(t, root)()
// New once
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
client := fn.New(fn.WithRegistry(TestRegistry))
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
// New again should fail as already initialized
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err == nil {
if err := client.New(context.Background(), fn.Function{Root: root}); err == nil {
t.Fatal("error expected initilizing a path already containing an initialized Function")
}
}
@ -89,8 +89,8 @@ func TestNonemptyDirectoryAborts(t *testing.T) {
t.Fatal(err)
}
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err == nil {
client := fn.New(fn.WithRegistry(TestRegistry))
if err := client.New(context.Background(), fn.Function{Root: root}); err == nil {
t.Fatal("error expected initilizing a Function in a nonempty directory")
}
}
@ -111,8 +111,8 @@ func TestHiddenFilesIgnored(t *testing.T) {
t.Fatal(err)
}
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
client := fn.New(fn.WithRegistry(TestRegistry))
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
}
@ -125,19 +125,19 @@ func TestDefaultRuntime(t *testing.T) {
defer using(t, root)()
// Create a new function at root with all defaults.
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
client := fn.New(fn.WithRegistry(TestRegistry))
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
// Load the function
f, err := bosonFunc.NewFunction(root)
f, err := fn.NewFunction(root)
if err != nil {
t.Fatal(err)
}
// Ensure it has defaulted runtime
if f.Runtime != bosonFunc.DefaultRuntime {
if f.Runtime != fn.DefaultRuntime {
t.Fatal("The default runtime was not applied or persisted.")
}
}
@ -157,12 +157,12 @@ func TestExtensibleRepositories(t *testing.T) {
defer using(t, root)()
// Create a new client with a path to the extensible templates
client := bosonFunc.New(
bosonFunc.WithRepositories("testdata/repositories"),
bosonFunc.WithRegistry(TestRegistry))
client := fn.New(
fn.WithRepositories("testdata/repositories"),
fn.WithRegistry(TestRegistry))
// Create a Function specifying a template which only exists in the extensible set
if err := client.New(context.Background(), bosonFunc.Function{Root: root, Runtime: "test", Template: "customProvider/tplc"}); err != nil {
if err := client.New(context.Background(), fn.Function{Root: root, Runtime: "test", Template: "customProvider/tplc"}); err != nil {
t.Fatal(err)
}
@ -180,13 +180,13 @@ func TestRuntimeNotFound(t *testing.T) {
root := "testdata/example.com/testRuntimeNotFound"
defer using(t, root)()
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
client := fn.New(fn.WithRegistry(TestRegistry))
// creating a Function with an unsupported runtime should bubble
// the error generated by the underlying template initializer.
f := bosonFunc.Function{Root: root, Runtime: "invalid"}
f := fn.Function{Root: root, Runtime: "invalid"}
err := client.New(context.Background(), f)
if !errors.Is(err, bosonFunc.ErrRuntimeNotFound) {
if !errors.Is(err, fn.ErrRuntimeNotFound) {
t.Fatalf("Expected ErrRuntimeNotFound, got %T", err)
}
}
@ -198,17 +198,17 @@ func TestRuntimeNotFoundCustom(t *testing.T) {
defer using(t, root)()
// Create a new client with path to the extensible templates
client := bosonFunc.New(
bosonFunc.WithRepositories("testdata/repositories"),
bosonFunc.WithRegistry(TestRegistry))
client := fn.New(
fn.WithRepositories("testdata/repositories"),
fn.WithRegistry(TestRegistry))
// Create a Function specifying a runtime, 'python' that does not exist
// in the custom (testdata) repository but does in the embedded.
f := bosonFunc.Function{Root: root, Runtime: "python", Template: "customProvider/event"}
f := fn.Function{Root: root, Runtime: "python", Template: "customProvider/event"}
// creating should error as runtime not found
err := client.New(context.Background(), f)
if !errors.Is(err, bosonFunc.ErrRuntimeNotFound) {
if !errors.Is(err, fn.ErrRuntimeNotFound) {
t.Fatalf("Expected ErrRuntimeNotFound, got %v", err)
}
}
@ -218,13 +218,13 @@ func TestTemplateNotFound(t *testing.T) {
root := "testdata/example.com/testTemplateNotFound"
defer using(t, root)()
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
client := fn.New(fn.WithRegistry(TestRegistry))
// creating a Function with an unsupported runtime should bubble
// the error generated by the unsderlying template initializer.
f := bosonFunc.Function{Root: root, Runtime: "go", Template: "invalid"}
f := fn.Function{Root: root, Runtime: "go", Template: "invalid"}
err := client.New(context.Background(), f)
if !errors.Is(err, bosonFunc.ErrTemplateNotFound) {
if !errors.Is(err, fn.ErrTemplateNotFound) {
t.Fatalf("Expected ErrTemplateNotFound, got %v", err)
}
}
@ -236,16 +236,16 @@ func TestTemplateNotFoundCustom(t *testing.T) {
defer using(t, root)()
// Create a new client with path to extensible templates
client := bosonFunc.New(
bosonFunc.WithRepositories("testdata/repositories"),
bosonFunc.WithRegistry(TestRegistry))
client := fn.New(
fn.WithRepositories("testdata/repositories"),
fn.WithRegistry(TestRegistry))
// An invalid template, but a valid custom provider
f := bosonFunc.Function{Root: root, Runtime: "test", Template: "customProvider/invalid"}
f := fn.Function{Root: root, Runtime: "test", Template: "customProvider/invalid"}
// Creation should generate the correct error of template not being found.
err := client.New(context.Background(), f)
if !errors.Is(err, bosonFunc.ErrTemplateNotFound) {
if !errors.Is(err, fn.ErrTemplateNotFound) {
t.Fatalf("Expected ErrTemplateNotFound, got %v", err)
}
}
@ -261,13 +261,13 @@ func TestNamed(t *testing.T) {
root := "testdata/example.com/testWithName"
defer using(t, root)()
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
client := fn.New(fn.WithRegistry(TestRegistry))
if err := client.New(context.Background(), bosonFunc.Function{Root: root, Name: name}); err != nil {
if err := client.New(context.Background(), fn.Function{Root: root, Name: name}); err != nil {
t.Fatal(err)
}
f, err := bosonFunc.NewFunction(root)
f, err := fn.NewFunction(root)
if err != nil {
t.Fatal(err)
}
@ -292,9 +292,9 @@ func TestRegistryRequired(t *testing.T) {
root := "testdata/example.com/testRegistry"
defer using(t, root)()
client := bosonFunc.New()
client := fn.New()
var err error
if err = client.New(context.Background(), bosonFunc.Function{Root: root}); err == nil {
if err = client.New(context.Background(), fn.Function{Root: root}); err == nil {
t.Fatal("did not receive expected error creating a Function without specifying Registry")
}
fmt.Println(err)
@ -309,13 +309,13 @@ func TestDeriveImage(t *testing.T) {
defer using(t, root)()
// Create the function which calculates fields such as name and image.
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
client := fn.New(fn.WithRegistry(TestRegistry))
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
// Load the function with the now-populated fields.
f, err := bosonFunc.NewFunction(root)
f, err := fn.NewFunction(root)
if err != nil {
t.Fatal(err)
}
@ -338,19 +338,19 @@ func TestDeriveImageDefaultRegistry(t *testing.T) {
// Create the function which calculates fields such as name and image.
// Rather than use TestRegistry, use a single-token name and expect
// the DefaultRegistry to be prepended.
client := bosonFunc.New(bosonFunc.WithRegistry("alice"))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
client := fn.New(fn.WithRegistry("alice"))
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
// Load the function with the now-populated fields.
f, err := bosonFunc.NewFunction(root)
f, err := fn.NewFunction(root)
if err != nil {
t.Fatal(err)
}
// Expected image is [DefaultRegistry]/[namespace]/[servicename]:latest
expected := bosonFunc.DefaultRegistry + "/alice/" + f.Name + ":latest"
expected := fn.DefaultRegistry + "/alice/" + f.Name + ":latest"
if f.Image != expected {
t.Fatalf("expected image '%v' got '%v'", expected, f.Image)
}
@ -373,11 +373,11 @@ func TestNewDelegates(t *testing.T) {
defer using(t, root)()
// Create a client with mocks for each of the subcomponents.
client := bosonFunc.New(
bosonFunc.WithRegistry(TestRegistry),
bosonFunc.WithBuilder(builder), // builds an image
bosonFunc.WithPusher(pusher), // pushes images to a registry
bosonFunc.WithDeployer(deployer), // deploys images as a running service
client := fn.New(
fn.WithRegistry(TestRegistry),
fn.WithBuilder(builder), // builds an image
fn.WithPusher(pusher), // pushes images to a registry
fn.WithDeployer(deployer), // deploys images as a running service
)
// Register Function delegates on the mocks which validate assertions
@ -385,7 +385,7 @@ func TestNewDelegates(t *testing.T) {
// The builder should be invoked with a path to a Function project's source
// An example image name is returned.
builder.BuildFn = func(f bosonFunc.Function) error {
builder.BuildFn = func(f fn.Function) error {
expectedPath, err := filepath.Abs(root)
if err != nil {
t.Fatal(err)
@ -396,14 +396,14 @@ func TestNewDelegates(t *testing.T) {
return nil
}
pusher.PushFn = func(f bosonFunc.Function) (string, error) {
pusher.PushFn = func(f fn.Function) (string, error) {
if f.Image != expectedImage {
t.Fatalf("pusher expected image '%v', got '%v'", expectedImage, f.Image)
}
return "", nil
}
deployer.DeployFn = func(f bosonFunc.Function) error {
deployer.DeployFn = func(f fn.Function) error {
if f.Name != expectedName {
t.Fatalf("deployer expected name '%v', got '%v'", expectedName, f.Name)
}
@ -418,7 +418,7 @@ func TestNewDelegates(t *testing.T) {
// Invoke the creation, triggering the Function delegates, and
// perform follow-up assertions that the Functions were indeed invoked.
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
@ -442,8 +442,8 @@ func TestRun(t *testing.T) {
// Create a client with the mock runner and the new test Function
runner := mock.NewRunner()
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry), bosonFunc.WithRunner(runner))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
client := fn.New(fn.WithRegistry(TestRegistry), fn.WithRunner(runner))
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
@ -481,19 +481,19 @@ func TestUpdate(t *testing.T) {
defer using(t, root)()
// A client with mocks whose implementaton will validate input.
client := bosonFunc.New(
bosonFunc.WithRegistry(TestRegistry),
bosonFunc.WithBuilder(builder),
bosonFunc.WithPusher(pusher),
bosonFunc.WithDeployer(deployer))
client := fn.New(
fn.WithRegistry(TestRegistry),
fn.WithBuilder(builder),
fn.WithPusher(pusher),
fn.WithDeployer(deployer))
// create the new Function which will be updated
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
// Builder whose implementation verifies the expected root
builder.BuildFn = func(f bosonFunc.Function) error {
builder.BuildFn = func(f fn.Function) error {
rootPath, err := filepath.Abs(root)
if err != nil {
t.Fatal(err)
@ -505,7 +505,7 @@ func TestUpdate(t *testing.T) {
}
// Pusher whose implementaiton verifies the expected image
pusher.PushFn = func(f bosonFunc.Function) (string, error) {
pusher.PushFn = func(f fn.Function) (string, error) {
if f.Image != expectedImage {
t.Fatalf("pusher expected image '%v', got '%v'", expectedImage, f.Image)
}
@ -514,7 +514,7 @@ func TestUpdate(t *testing.T) {
}
// Update whose implementaiton verifed the expected name and image
deployer.DeployFn = func(f bosonFunc.Function) error {
deployer.DeployFn = func(f fn.Function) error {
if f.Name != expectedName {
t.Fatalf("updater expected name '%v', got '%v'", expectedName, f.Name)
}
@ -552,11 +552,11 @@ func TestRemoveByPath(t *testing.T) {
defer using(t, root)()
client := bosonFunc.New(
bosonFunc.WithRegistry(TestRegistry),
bosonFunc.WithRemover(remover))
client := fn.New(
fn.WithRegistry(TestRegistry),
fn.WithRemover(remover))
if err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {
if err := client.New(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
@ -567,7 +567,7 @@ func TestRemoveByPath(t *testing.T) {
return nil
}
if err := client.Remove(context.Background(), bosonFunc.Function{Root: root}); err != nil {
if err := client.Remove(context.Background(), fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
@ -588,11 +588,11 @@ func TestRemoveByName(t *testing.T) {
defer using(t, root)()
client := bosonFunc.New(
bosonFunc.WithRegistry(TestRegistry),
bosonFunc.WithRemover(remover))
client := fn.New(
fn.WithRegistry(TestRegistry),
fn.WithRemover(remover))
if err := client.Create(bosonFunc.Function{Root: root}); err != nil {
if err := client.Create(fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
@ -604,12 +604,12 @@ func TestRemoveByName(t *testing.T) {
}
// Run remove with only a name
if err := client.Remove(context.Background(), bosonFunc.Function{Name: expectedName}); err != nil {
if err := client.Remove(context.Background(), fn.Function{Name: expectedName}); err != nil {
t.Fatal(err)
}
// Run remove with a name and a root, which should be ignored in favor of the name.
if err := client.Remove(context.Background(), bosonFunc.Function{Name: expectedName, Root: root}); err != nil {
if err := client.Remove(context.Background(), fn.Function{Name: expectedName, Root: root}); err != nil {
t.Fatal(err)
}
@ -635,12 +635,12 @@ func TestRemoveUninitializedFails(t *testing.T) {
}
// Instantiate the client with the failing remover.
client := bosonFunc.New(
bosonFunc.WithRegistry(TestRegistry),
bosonFunc.WithRemover(remover))
client := fn.New(
fn.WithRegistry(TestRegistry),
fn.WithRemover(remover))
// Attempt to remove by path (uninitialized), expecting an error.
if err := client.Remove(context.Background(), bosonFunc.Function{Root: root}); err == nil {
if err := client.Remove(context.Background(), fn.Function{Root: root}); err == nil {
t.Fatalf("did not received expeced error removing an uninitialized func")
}
}
@ -649,7 +649,7 @@ func TestRemoveUninitializedFails(t *testing.T) {
func TestList(t *testing.T) {
lister := mock.NewLister()
client := bosonFunc.New(bosonFunc.WithLister(lister)) // lists deployed Functions.
client := fn.New(fn.WithLister(lister)) // lists deployed Functions.
if _, err := client.List(context.Background()); err != nil {
t.Fatal(err)
@ -668,7 +668,7 @@ func TestListOutsideRoot(t *testing.T) {
lister := mock.NewLister()
// Instantiate in the current working directory, with no name.
client := bosonFunc.New(bosonFunc.WithLister(lister))
client := fn.New(fn.WithLister(lister))
if _, err := client.List(context.Background()); err != nil {
t.Fatal(err)
@ -687,10 +687,10 @@ func TestDeployUnbuilt(t *testing.T) {
defer using(t, root)()
// New Client
client := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))
client := fn.New(fn.WithRegistry(TestRegistry))
// Initialize (half-create) a new Function at root
if err := client.Create(bosonFunc.Function{Root: root}); err != nil {
if err := client.Create(fn.Function{Root: root}); err != nil {
t.Fatal(err)
}
@ -700,7 +700,7 @@ func TestDeployUnbuilt(t *testing.T) {
t.Fatal("did not receive an error attempting to deploy an unbuilt Function")
}
if !errors.Is(err, bosonFunc.ErrNotBuilt) {
if !errors.Is(err, fn.ErrNotBuilt) {
t.Fatalf("did not receive expected error type. Expected ErrNotBuilt, got %T", err)
}
}
@ -719,7 +719,7 @@ func TestEmit(t *testing.T) {
}
// Instantiate in the current working directory, with no name.
client := bosonFunc.New(bosonFunc.WithEmitter(emitter))
client := fn.New(fn.WithEmitter(emitter))
if err := client.Emit(context.Background(), sink); err != nil {
t.Fatal(err)

View File

@ -8,7 +8,7 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/buildpacks"
"github.com/boson-project/func/progress"
)
@ -119,11 +119,11 @@ func runBuild(cmd *cobra.Command, _ []string) (err error) {
listener.Done()
}()
client := bosonFunc.New(
bosonFunc.WithVerbose(config.Verbose),
bosonFunc.WithRegistry(config.Registry), // for deriving image name when --image not provided explicitly.
bosonFunc.WithBuilder(builder),
bosonFunc.WithProgressListener(listener))
client := fn.New(
fn.WithVerbose(config.Verbose),
fn.WithRegistry(config.Registry), // for deriving image name when --image not provided explicitly.
fn.WithBuilder(builder),
fn.WithProgressListener(listener))
return client.Build(context, config.Path)
}

View File

@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/buildpacks"
"github.com/boson-project/func/knative"
)
@ -79,7 +79,7 @@ func CompleteBuilderList(cmd *cobra.Command, args []string, complete string) (st
var (
err error
path string
f bosonFunc.Function
f fn.Function
)
path, err = cmd.Flags().GetString("path")
@ -87,7 +87,7 @@ func CompleteBuilderList(cmd *cobra.Command, args []string, complete string) (st
return
}
f, err = bosonFunc.NewFunction(path)
f, err = fn.NewFunction(path)
if err != nil {
return
}

View File

@ -8,7 +8,7 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
func init() {
@ -113,17 +113,17 @@ func newConfigCmdConfig(args []string) configCmdConfig {
}
func initConfigCommand(args []string) (bosonFunc.Function, error) {
func initConfigCommand(args []string) (fn.Function, error) {
config := newConfigCmdConfig(args)
function, err := bosonFunc.NewFunction(config.Path)
function, err := fn.NewFunction(config.Path)
if err != nil {
return bosonFunc.Function{}, err
return fn.Function{}, err
}
// Check if the Function has been initialized
if !function.Initialized() {
return bosonFunc.Function{}, fmt.Errorf("the given path '%v' does not contain an initialized function", config.Path)
return fn.Function{}, fmt.Errorf("the given path '%v' does not contain an initialized function", config.Path)
}
return function, nil

View File

@ -9,7 +9,7 @@ import (
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/spf13/cobra"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/k8s"
"github.com/boson-project/func/utils"
)
@ -88,7 +88,7 @@ in the current directory or from the directory specified with --path.
},
}
func listEnvs(f bosonFunc.Function) {
func listEnvs(f fn.Function) {
if len(f.Envs) == 0 {
fmt.Println("There aren't any configured Environment variables")
return
@ -100,7 +100,7 @@ func listEnvs(f bosonFunc.Function) {
}
}
func runAddEnvsPrompt(ctx context.Context, f bosonFunc.Function) (err error) {
func runAddEnvsPrompt(ctx context.Context, f fn.Function) (err error) {
insertToIndex := 0
@ -175,7 +175,7 @@ func runAddEnvsPrompt(ctx context.Context, f bosonFunc.Function) (err error) {
return
}
newEnv := bosonFunc.Env{}
newEnv := fn.Env{}
switch selectedOption {
// SECTION - add new Environment variable with the specified value
@ -379,7 +379,7 @@ func runAddEnvsPrompt(ctx context.Context, f bosonFunc.Function) (err error) {
return
}
func runRemoveEnvsPrompt(f bosonFunc.Function) (err error) {
func runRemoveEnvsPrompt(f fn.Function) (err error) {
if len(f.Envs) == 0 {
fmt.Println("There aren't any configured Environment variables")
return
@ -403,7 +403,7 @@ func runRemoveEnvsPrompt(f bosonFunc.Function) (err error) {
return
}
var newEnvs bosonFunc.Envs
var newEnvs fn.Envs
removed := false
for i, e := range f.Envs {
if e.String() == selectedEnv {

View File

@ -9,7 +9,7 @@ import (
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/spf13/cobra"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/k8s"
)
@ -84,7 +84,7 @@ in the current directory or from the directory specified with --path.
},
}
func listVolumes(f bosonFunc.Function) {
func listVolumes(f fn.Function) {
if len(f.Volumes) == 0 {
fmt.Println("There aren't any configured Volume mounts")
return
@ -96,7 +96,7 @@ func listVolumes(f bosonFunc.Function) {
}
}
func runAddVolumesPrompt(ctx context.Context, f bosonFunc.Function) (err error) {
func runAddVolumesPrompt(ctx context.Context, f fn.Function) (err error) {
secrets, err := k8s.ListSecretsNames(ctx, f.Namespace)
if err != nil {
@ -182,7 +182,7 @@ func runAddVolumesPrompt(ctx context.Context, f bosonFunc.Function) (err error)
}
// we have all necessary information -> let's store the new Volume
newVolume := bosonFunc.Volume{Path: &path}
newVolume := fn.Volume{Path: &path}
switch selectedOption {
case optionConfigMap:
newVolume.ConfigMap = &selectedResource
@ -200,7 +200,7 @@ func runAddVolumesPrompt(ctx context.Context, f bosonFunc.Function) (err error)
return
}
func runRemoveVolumesPrompt(f bosonFunc.Function) (err error) {
func runRemoveVolumesPrompt(f fn.Function) (err error) {
if len(f.Volumes) == 0 {
fmt.Println("There aren't any configured Volume mounts")
return
@ -224,7 +224,7 @@ func runRemoveVolumesPrompt(f bosonFunc.Function) (err error) {
return
}
var newVolumes bosonFunc.Volumes
var newVolumes fn.Volumes
removed := false
for i, v := range f.Volumes {
if v.String() == selectedVolume {

View File

@ -9,7 +9,7 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/buildpacks"
"github.com/boson-project/func/utils"
)
@ -17,9 +17,9 @@ import (
func init() {
root.AddCommand(createCmd)
createCmd.Flags().BoolP("confirm", "c", false, "Prompt to confirm all configuration options (Env: $FUNC_CONFIRM)")
createCmd.Flags().StringP("runtime", "l", bosonFunc.DefaultRuntime, "Function runtime language/framework. Available runtimes: "+buildpacks.Runtimes()+" (Env: $FUNC_RUNTIME)")
createCmd.Flags().StringP("runtime", "l", fn.DefaultRuntime, "Function runtime language/framework. Available runtimes: "+buildpacks.Runtimes()+" (Env: $FUNC_RUNTIME)")
createCmd.Flags().StringP("repositories", "r", filepath.Join(configPath(), "repositories"), "Path to extended template repositories (Env: $FUNC_REPOSITORIES)")
createCmd.Flags().StringP("template", "t", bosonFunc.DefaultTemplate, "Function template. Available templates: 'http' and 'events' (Env: $FUNC_TEMPLATE)")
createCmd.Flags().StringP("template", "t", fn.DefaultTemplate, "Function template. Available templates: 'http' and 'events' (Env: $FUNC_TEMPLATE)")
if err := createCmd.RegisterFlagCompletionFunc("runtime", CompleteRuntimeList); err != nil {
fmt.Println("internal: error while calling RegisterFlagCompletionFunc: ", err)
@ -69,16 +69,16 @@ func runCreate(cmd *cobra.Command, args []string) (err error) {
return
}
function := bosonFunc.Function{
function := fn.Function{
Name: config.Name,
Root: config.Path,
Runtime: config.Runtime,
Template: config.Template,
}
client := bosonFunc.New(
bosonFunc.WithRepositories(config.Repositories),
bosonFunc.WithVerbose(config.Verbose))
client := fn.New(
fn.WithRepositories(config.Repositories),
fn.WithVerbose(config.Verbose))
return client.Create(function)
}

View File

@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"
"knative.dev/client/pkg/util"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/buildpacks"
"github.com/boson-project/func/docker"
"github.com/boson-project/func/knative"
@ -154,13 +154,13 @@ func runDeploy(cmd *cobra.Command, _ []string) (err error) {
listener.Done()
}()
client := bosonFunc.New(
bosonFunc.WithVerbose(config.Verbose),
bosonFunc.WithRegistry(config.Registry), // for deriving image name when --image not provided explicitly.
bosonFunc.WithBuilder(builder),
bosonFunc.WithPusher(pusher),
bosonFunc.WithDeployer(deployer),
bosonFunc.WithProgressListener(listener))
client := fn.New(
fn.WithVerbose(config.Verbose),
fn.WithRegistry(config.Registry), // for deriving image name when --image not provided explicitly.
fn.WithBuilder(builder),
fn.WithPusher(pusher),
fn.WithDeployer(deployer),
fn.WithProgressListener(listener))
if config.Build {
if err := client.Build(context, config.Path); err != nil {

View File

@ -11,7 +11,7 @@ import (
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/knative"
)
@ -51,7 +51,7 @@ kn func describe --output yaml --path myotherfunc
func runDescribe(cmd *cobra.Command, args []string) (err error) {
config := newDescribeConfig(args)
function, err := bosonFunc.NewFunction(config.Path)
function, err := fn.NewFunction(config.Path)
if err != nil {
return
}
@ -67,9 +67,9 @@ func runDescribe(cmd *cobra.Command, args []string) (err error) {
}
describer.Verbose = config.Verbose
client := bosonFunc.New(
bosonFunc.WithVerbose(config.Verbose),
bosonFunc.WithDescriber(describer))
client := fn.New(
fn.WithVerbose(config.Verbose),
fn.WithDescriber(describer))
d, err := client.Describe(cmd.Context(), config.Name, config.Path)
if err != nil {
@ -109,7 +109,7 @@ func newDescribeConfig(args []string) describeConfig {
// Output Formatting (serializers)
// -------------------------------
type description bosonFunc.Description
type description fn.Description
func (d description) Human(w io.Writer) error {
fmt.Fprintln(w, "Function name:")

View File

@ -12,7 +12,7 @@ import (
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/knative"
)
@ -66,9 +66,9 @@ func runList(cmd *cobra.Command, args []string) (err error) {
lister.Namespace = ""
}
client := bosonFunc.New(
bosonFunc.WithVerbose(config.Verbose),
bosonFunc.WithLister(lister))
client := fn.New(
fn.WithVerbose(config.Verbose),
fn.WithLister(lister))
items, err := client.List(cmd.Context())
if err != nil {
@ -105,7 +105,7 @@ func newListConfig() listConfig {
// Output Formatting (serializers)
// -------------------------------
type listItems []bosonFunc.ListItem
type listItems []fn.ListItem
func (items listItems) Human(w io.Writer) error {
return items.Plain(w)

View File

@ -13,7 +13,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"knative.dev/client/pkg/util"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
// The root of the command tree defines the command name, descriotion, globally
@ -152,8 +152,8 @@ type functionOverrides struct {
// Function project at root, if provided, and returns the Function
// configuration values.
// Please note that When this function is called, the overrides are not persisted.
func functionWithOverrides(root string, overrides functionOverrides) (f bosonFunc.Function, err error) {
f, err = bosonFunc.NewFunction(root)
func functionWithOverrides(root string, overrides functionOverrides) (f fn.Function, err error) {
f, err = fn.NewFunction(root)
if err != nil {
return
}
@ -186,7 +186,7 @@ func deriveName(explicitName string, path string) string {
}
// If the directory at path contains an initialized Function, use the name therein
f, err := bosonFunc.NewFunction(path)
f, err := fn.NewFunction(path)
if err == nil && f.Name != "" {
return f.Name
}
@ -242,14 +242,14 @@ func deriveImage(explicitImage, defaultRegistry, path string) string {
if explicitImage != "" {
return explicitImage // use the explicit value provided.
}
f, err := bosonFunc.NewFunction(path)
f, err := fn.NewFunction(path)
if err != nil {
return "" // unable to derive due to load error (uninitialized?)
}
if f.Image != "" {
return f.Image // use value previously provided or derived.
}
derivedValue, _ := bosonFunc.DerivedImage(path, defaultRegistry)
derivedValue, _ := fn.DerivedImage(path, defaultRegistry)
return derivedValue // Use the func system's derivation logic.
}
@ -264,7 +264,7 @@ func envFromCmd(cmd *cobra.Command) (*util.OrderedMap, []string, error) {
return util.NewOrderedMap(), []string{}, nil
}
func mergeEnvs(envs bosonFunc.Envs, envToUpdate *util.OrderedMap, envToRemove []string) (bosonFunc.Envs, error) {
func mergeEnvs(envs fn.Envs, envToUpdate *util.OrderedMap, envToRemove []string) (fn.Envs, error) {
updated := sets.NewString()
for i := range envs {
@ -282,7 +282,7 @@ func mergeEnvs(envs bosonFunc.Envs, envToUpdate *util.OrderedMap, envToRemove []
if !updated.Has(name) {
n := name
v := value
envs = append(envs, bosonFunc.Env{Name: &n, Value: &v})
envs = append(envs, fn.Env{Name: &n, Value: &v})
}
}
@ -295,9 +295,9 @@ func mergeEnvs(envs bosonFunc.Envs, envToUpdate *util.OrderedMap, envToRemove []
}
}
errMsg := bosonFunc.ValidateEnvs(envs)
errMsg := fn.ValidateEnvs(envs)
if len(errMsg) > 0 {
return bosonFunc.Envs{}, fmt.Errorf(strings.Join(errMsg, "\n"))
return fn.Envs{}, fmt.Errorf(strings.Join(errMsg, "\n"))
}
return envs, nil

View File

@ -7,7 +7,7 @@ import (
"knative.dev/client/pkg/util"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
func Test_mergeEnvMaps(t *testing.T) {
@ -18,77 +18,77 @@ func Test_mergeEnvMaps(t *testing.T) {
v2 := "y"
type args struct {
envs bosonFunc.Envs
envs fn.Envs
toUpdate *util.OrderedMap
toRemove []string
}
tests := []struct {
name string
args args
want bosonFunc.Envs
want fn.Envs
}{
{
"add new var to empty list",
args{
bosonFunc.Envs{},
fn.Envs{},
util.NewOrderedMapWithKVStrings([][]string{{a, v1}}),
[]string{},
},
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v1}},
fn.Envs{fn.Env{Name: &a, Value: &v1}},
},
{
"add new var",
args{
bosonFunc.Envs{bosonFunc.Env{Name: &b, Value: &v2}},
fn.Envs{fn.Env{Name: &b, Value: &v2}},
util.NewOrderedMapWithKVStrings([][]string{{a, v1}}),
[]string{},
},
bosonFunc.Envs{bosonFunc.Env{Name: &b, Value: &v2}, bosonFunc.Env{Name: &a, Value: &v1}},
fn.Envs{fn.Env{Name: &b, Value: &v2}, fn.Env{Name: &a, Value: &v1}},
},
{
"update var",
args{
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v1}},
fn.Envs{fn.Env{Name: &a, Value: &v1}},
util.NewOrderedMapWithKVStrings([][]string{{a, v2}}),
[]string{},
},
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v2}},
fn.Envs{fn.Env{Name: &a, Value: &v2}},
},
{
"update multiple vars",
args{
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v1}, bosonFunc.Env{Name: &b, Value: &v2}},
fn.Envs{fn.Env{Name: &a, Value: &v1}, fn.Env{Name: &b, Value: &v2}},
util.NewOrderedMapWithKVStrings([][]string{{a, v2}, {b, v1}}),
[]string{},
},
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v2}, bosonFunc.Env{Name: &b, Value: &v1}},
fn.Envs{fn.Env{Name: &a, Value: &v2}, fn.Env{Name: &b, Value: &v1}},
},
{
"remove var",
args{
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v1}},
fn.Envs{fn.Env{Name: &a, Value: &v1}},
util.NewOrderedMap(),
[]string{a},
},
bosonFunc.Envs{},
fn.Envs{},
},
{
"remove multiple vars",
args{
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v1}, bosonFunc.Env{Name: &b, Value: &v2}},
fn.Envs{fn.Env{Name: &a, Value: &v1}, fn.Env{Name: &b, Value: &v2}},
util.NewOrderedMap(),
[]string{a, b},
},
bosonFunc.Envs{},
fn.Envs{},
},
{
"update and remove vars",
args{
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v1}, bosonFunc.Env{Name: &b, Value: &v2}},
fn.Envs{fn.Env{Name: &a, Value: &v1}, fn.Env{Name: &b, Value: &v2}},
util.NewOrderedMapWithKVStrings([][]string{{a, v2}}),
[]string{b},
},
bosonFunc.Envs{bosonFunc.Env{Name: &a, Value: &v2}},
fn.Envs{fn.Env{Name: &a, Value: &v2}},
},
}
for _, tt := range tests {

View File

@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"
"knative.dev/client/pkg/util"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/docker"
)
@ -46,7 +46,7 @@ func runRun(cmd *cobra.Command, args []string) (err error) {
return
}
function, err := bosonFunc.NewFunction(config.Path)
function, err := fn.NewFunction(config.Path)
if err != nil {
return
}
@ -69,9 +69,9 @@ func runRun(cmd *cobra.Command, args []string) (err error) {
runner := docker.NewRunner()
runner.Verbose = config.Verbose
client := bosonFunc.New(
bosonFunc.WithRunner(runner),
bosonFunc.WithVerbose(config.Verbose))
client := fn.New(
fn.WithRunner(runner),
fn.WithVerbose(config.Verbose))
err = client.Run(cmd.Context(), config.Path)
return

View File

@ -15,7 +15,7 @@ import (
"github.com/docker/docker/client"
"github.com/pkg/errors"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
type Opt func(*Pusher) error
@ -30,7 +30,7 @@ type CredentialsProvider func(ctx context.Context, registry string) (Credentials
// Pusher of images from local to remote registry.
type Pusher struct {
// Verbose logging.
Verbose bool
Verbose bool
credentialsProvider CredentialsProvider
}
@ -48,7 +48,7 @@ func EmptyCredentialsProvider(ctx context.Context, registry string) (Credentials
// NewPusher creates an instance of a docker-based image pusher.
func NewPusher(opts ...Opt) (*Pusher, error) {
result := &Pusher{
Verbose: false,
Verbose: false,
credentialsProvider: EmptyCredentialsProvider,
}
for _, opt := range opts {
@ -61,7 +61,7 @@ func NewPusher(opts ...Opt) (*Pusher, error) {
}
// Push the image of the Function.
func (n *Pusher) Push(ctx context.Context, f bosonFunc.Function) (digest string, err error) {
func (n *Pusher) Push(ctx context.Context, f fn.Function) (digest string, err error) {
if f.Image == "" {
return "", errors.New("Function has no associated image. Has it been built?")
@ -71,7 +71,7 @@ func (n *Pusher) Push(ctx context.Context, f bosonFunc.Function) (digest string,
parts := strings.Split(f.Image, "/")
switch len(parts) {
case 2:
registry = bosonFunc.DefaultRegistry
registry = fn.DefaultRegistry
case 3:
registry = parts[0]
default:

View File

@ -16,7 +16,7 @@ import (
"github.com/docker/docker/client"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
// Runner of functions using the docker command.
@ -31,7 +31,7 @@ func NewRunner() *Runner {
}
// Run the function at path
func (n *Runner) Run(ctx context.Context, f bosonFunc.Function) error {
func (n *Runner) Run(ctx context.Context, f fn.Function) error {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

View File

@ -9,7 +9,7 @@ import (
"os"
"testing"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/docker"
)
@ -27,7 +27,7 @@ func TestDockerRun(t *testing.T) {
t.Skip()
}
f, err := bosonFunc.NewFunction("testdata/example.com/runnable")
f, err := fn.NewFunction("testdata/example.com/runnable")
if err != nil {
t.Fatal(err)
}

View File

@ -9,7 +9,7 @@ To create a Client which uses the included buildpacks-based function builder, pu
package main
import (
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/buildpacks"
"github.com/boson-project/func/docker"
"github.com/boson-project/func/knative"
@ -28,16 +28,16 @@ func main() {
// A client which uses embedded function templates,
// Quay.io/alice for interstitial build artifacts.
// Docker to build and push, and a Knative client for deployment.
client := bosonFunc.New(
bosonFunc.WithBuilder(buildpacks.NewBuilder()),
bosonFunc.WithPusher(pusher),
bosonFunc.WithDeployer(deployer),
bosonFunc.WithRegistry("quay.io/alice"))
client := fn.New(
fn.WithBuilder(buildpacks.NewBuilder()),
fn.WithPusher(pusher),
fn.WithDeployer(deployer),
fn.WithRegistry("quay.io/alice"))
// Create a Go function which listens for CloudEvents.
// Publicly routable as https://www.example.com.
// Local implementation is written to the current working directory.
funcTest := bosonFunc.Function{
funcTest := fn.Function{
Runtime: "go",
Name: "my-function",
Image: "quay.io/alice/my-function",

View File

@ -7,7 +7,7 @@ import (
v1 "knative.dev/client/pkg/serving/v1"
"knative.dev/eventing/pkg/apis/eventing/v1beta1"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/k8s"
)
@ -31,7 +31,7 @@ func NewDescriber(namespaceOverride string) (describer *Describer, err error) {
// restricts to label-syntax, which is thus escaped. Therefore as a knative (kube) implementation
// detal proper full names have to be escaped on the way in and unescaped on the way out. ex:
// www.example-site.com -> www-example--site-com
func (d *Describer) Describe(ctx context.Context, name string) (description bosonFunc.Description, err error) {
func (d *Describer) Describe(ctx context.Context, name string) (description fn.Description, err error) {
servingClient, err := NewServingClient(d.namespace)
if err != nil {
@ -71,11 +71,11 @@ func (d *Describer) Describe(ctx context.Context, name string) (description boso
}
subscriptions := make([]bosonFunc.Subscription, 0, len(triggers.Items))
subscriptions := make([]fn.Subscription, 0, len(triggers.Items))
for _, trigger := range triggers.Items {
if triggerMatches(&trigger) {
filterAttrs := trigger.Spec.Filter.Attributes
subscription := bosonFunc.Subscription{
subscription := fn.Subscription{
Source: filterAttrs["source"],
Type: filterAttrs["type"],
Broker: trigger.Spec.Broker,

View File

@ -6,7 +6,7 @@ import (
clientservingv1 "knative.dev/client/pkg/serving/v1"
"knative.dev/pkg/apis"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
"github.com/boson-project/func/k8s"
)
@ -32,7 +32,7 @@ func NewLister(namespaceOverride string) (l *Lister, err error) {
return
}
func (l *Lister) List(ctx context.Context) (items []bosonFunc.ListItem, err error) {
func (l *Lister) List(ctx context.Context) (items []fn.ListItem, err error) {
client, err := NewServingClient(l.Namespace)
if err != nil {
@ -55,7 +55,7 @@ func (l *Lister) List(ctx context.Context) (items []bosonFunc.ListItem, err erro
}
}
listItem := bosonFunc.ListItem{
listItem := fn.ListItem{
Name: service.Name,
Namespace: service.Namespace,
Runtime: service.Labels["boson.dev/runtime"],

View File

@ -2,21 +2,21 @@ package mock
import (
"context"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
type Builder struct {
BuildInvoked bool
BuildFn func(bosonFunc.Function) error
BuildFn func(fn.Function) error
}
func NewBuilder() *Builder {
return &Builder{
BuildFn: func(bosonFunc.Function) error { return nil },
BuildFn: func(fn.Function) error { return nil },
}
}
func (i *Builder) Build(ctx context.Context, f bosonFunc.Function) error {
func (i *Builder) Build(ctx context.Context, f fn.Function) error {
i.BuildInvoked = true
return i.BuildFn(f)
}

View File

@ -3,21 +3,21 @@ package mock
import (
"context"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
type Deployer struct {
DeployInvoked bool
DeployFn func(bosonFunc.Function) error
DeployFn func(fn.Function) error
}
func NewDeployer() *Deployer {
return &Deployer{
DeployFn: func(bosonFunc.Function) error { return nil },
DeployFn: func(fn.Function) error { return nil },
}
}
func (i *Deployer) Deploy(ctx context.Context, f bosonFunc.Function) (bosonFunc.DeploymentResult, error) {
func (i *Deployer) Deploy(ctx context.Context, f fn.Function) (fn.DeploymentResult, error) {
i.DeployInvoked = true
return bosonFunc.DeploymentResult{}, i.DeployFn(f)
return fn.DeploymentResult{}, i.DeployFn(f)
}

View File

@ -2,21 +2,21 @@ package mock
import (
"context"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
type Lister struct {
ListInvoked bool
ListFn func() ([]bosonFunc.ListItem, error)
ListFn func() ([]fn.ListItem, error)
}
func NewLister() *Lister {
return &Lister{
ListFn: func() ([]bosonFunc.ListItem, error) { return []bosonFunc.ListItem{}, nil },
ListFn: func() ([]fn.ListItem, error) { return []fn.ListItem{}, nil },
}
}
func (l *Lister) List(context.Context) ([]bosonFunc.ListItem, error) {
func (l *Lister) List(context.Context) ([]fn.ListItem, error) {
l.ListInvoked = true
return l.ListFn()
}

View File

@ -3,21 +3,21 @@ package mock
import (
"context"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
type Pusher struct {
PushInvoked bool
PushFn func(bosonFunc.Function) (string, error)
PushFn func(fn.Function) (string, error)
}
func NewPusher() *Pusher {
return &Pusher{
PushFn: func(bosonFunc.Function) (string, error) { return "", nil },
PushFn: func(fn.Function) (string, error) { return "", nil },
}
}
func (i *Pusher) Push(ctx context.Context, f bosonFunc.Function) (string, error) {
func (i *Pusher) Push(ctx context.Context, f fn.Function) (string, error) {
i.PushInvoked = true
return i.PushFn(f)
}

View File

@ -2,7 +2,7 @@ package mock
import (
"context"
bosonFunc "github.com/boson-project/func"
fn "github.com/boson-project/func"
)
type Runner struct {
@ -14,7 +14,7 @@ func NewRunner() *Runner {
return &Runner{}
}
func (r *Runner) Run(ctx context.Context, f bosonFunc.Function) error {
func (r *Runner) Run(ctx context.Context, f fn.Function) error {
r.RunInvoked = true
r.RootRequested = f.Root
return nil