pulumi/pkg/codegen/hcl2/binder_schema_test.go
Pat Gavlin d07c3698e5
[codegen/{hcl2,schema}] Abstract package loading. (#4975)
Instead of requiring a plugin host for package loading in the HCL2
binder, define a much narrower interface that exposes the ability to
fetch the schema for a package at a specific version. This interface is
defined in the schema package, which also exposes a caching loader that
is backed by provider plugins.

These changes also add some convenience methods to `*schema.Package` for
fast access to particular resources and functions.

Related to #1635.
2020-07-07 14:45:18 -07:00

19 lines
435 B
Go

package hcl2
import (
"testing"
"github.com/pulumi/pulumi/pkg/v2/codegen/internal/test"
"github.com/pulumi/pulumi/pkg/v2/codegen/schema"
"github.com/pulumi/pulumi/sdk/v2/go/common/util/contract"
)
func BenchmarkLoadPackage(b *testing.B) {
loader := schema.NewPluginLoader(test.NewHost(testdataPath))
for n := 0; n < b.N; n++ {
_, err := NewPackageCache().loadPackageSchema(loader, "aws")
contract.AssertNoError(err)
}
}