cmd/build: don't package policy.wasm twice (#3011)

We had still been using the deprecated field, _and_ added a WasmModule
to the bundle, leading to two bundle file entries.

Fixes #3007.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
This commit is contained in:
Stephan Renatus
2020-12-16 20:48:05 +01:00
committed by GitHub
parent 0bdecba7e5
commit 09d88f9ec8
4 changed files with 10 additions and 11 deletions
+4 -6
View File
@@ -18,15 +18,13 @@ import (
"reflect"
"strings"
"github.com/open-policy-agent/opa/format"
"github.com/open-policy-agent/opa/internal/file/archive"
"github.com/open-policy-agent/opa/internal/merge"
"github.com/open-policy-agent/opa/metrics"
"github.com/pkg/errors"
"github.com/open-policy-agent/opa/ast"
"github.com/open-policy-agent/opa/format"
"github.com/open-policy-agent/opa/internal/file/archive"
"github.com/open-policy-agent/opa/internal/merge"
"github.com/open-policy-agent/opa/metrics"
"github.com/open-policy-agent/opa/util"
)
+2 -3
View File
@@ -12,11 +12,10 @@ import (
"os"
"strings"
"github.com/open-policy-agent/opa/ast"
"github.com/open-policy-agent/opa/bundle"
"github.com/spf13/cobra"
"github.com/open-policy-agent/opa/ast"
"github.com/open-policy-agent/opa/bundle"
"github.com/open-policy-agent/opa/compile"
"github.com/open-policy-agent/opa/util"
)
-2
View File
@@ -454,8 +454,6 @@ func (c *Compiler) compileWasm(ctx context.Context) error {
return err
}
c.bundle.Wasm = buf.Bytes()
modulePath := bundle.WasmFile
c.bundle.WasmModules = []bundle.WasmModuleFile{{
+4
View File
@@ -447,6 +447,10 @@ func TestCompilerWasmTarget(t *testing.T) {
t.Fatal("expected to find compiled wasm module")
}
if len(compiler.bundle.Wasm) != 0 {
t.Error("expected NOT to find deprecated bundle `Wasm` value")
}
ensureEntrypointRemoved(t, compiler.bundle, "test/p")
})
}