Test version
This commit is contained in:
@@ -27,7 +27,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Version is initialized by the Go linker to contain the semver of this build.
|
// Version is initialized by the Go linker to contain the semver of this build.
|
||||||
var Version string
|
var Version = "0.0.1"
|
||||||
|
|
||||||
// Name needs to match $PACK in Makefile.
|
// Name needs to match $PACK in Makefile.
|
||||||
const Name string = "docker-build"
|
const Name string = "docker-build"
|
||||||
@@ -62,7 +62,7 @@ func (p configurableProvider) Configure(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *rpc.ConfigureRequest,
|
request *rpc.ConfigureRequest,
|
||||||
) (*rpc.ConfigureResponse, error) {
|
) (*rpc.ConfigureResponse, error) {
|
||||||
schema := internal.Schema(ctx, "")
|
schema := internal.Schema(ctx, Version)
|
||||||
ce := deprecated.New(schema.Config)
|
ce := deprecated.New(schema.Config)
|
||||||
buildxReq := request
|
buildxReq := request
|
||||||
if props, err := ce.UnmarshalProperties(request.Args); err == nil {
|
if props, err := ce.UnmarshalProperties(request.Args); err == nil {
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/blang/semver"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
"google.golang.org/protobuf/types/known/structpb"
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
|
|
||||||
pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
|
pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
|
||||||
@@ -48,3 +50,19 @@ func TestConfigure(t *testing.T) {
|
|||||||
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestVersion(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
_, err := semver.Parse(Version)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
p, err := New(nil)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
info, err := p.GetPluginInfo(context.Background(), &emptypb.Empty{})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
require.NotEqual(t, "", Version)
|
||||||
|
assert.Equal(t, Version, info.Version)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user