Skip to content

Commit 95d6d39

Browse files
author
Tom Fay
authored
update test fixture (#4)
1 parent 4ac9c30 commit 95d6d39

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313

1414
# Dependency directories (remove the comment below to include it)
1515
# vendor/
16+
17+
crate_with_features_bin

rustaudit_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
package rustaudit
22

33
import (
4-
"github.com/stretchr/testify/assert"
54
"log"
65
"os"
76
"testing"
7+
8+
"github.com/stretchr/testify/assert"
89
)
910

1011
func TestLinuxRustDependencies(t *testing.T) {
1112
// Generate this with `DOCKER_BUILDKIT=1 docker build -f test/Dockerfile -o . .`
12-
r, err := os.Open("hello-auditable")
13+
r, err := os.Open("crate_with_features_bin")
1314
if err != nil {
1415
log.Fatal(err)
1516
}
1617
versionInfo, err := GetDependencyInfo(r)
1718
if err != nil {
1819
log.Fatal(err)
1920
}
20-
assert.Equal(t, 19, len(versionInfo.Packages))
21-
assert.Equal(t, Package{Name: "adler", Version: "1.0.2", Source: "registry", Kind: "build"}, versionInfo.Packages[0])
21+
assert.Equal(t, 2, len(versionInfo.Packages))
22+
assert.Equal(t, Package{Name: "crate_with_features", Version: "0.1.0", Source: "local", Kind: "runtime", Features: []string{"default", "library_crate"}, Dependencies: []uint{1}}, versionInfo.Packages[0])
2223
}

test/Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
FROM rust:1.62.0-bullseye as builder
2-
RUN git clone https://github.com/Shnatsel/rust-audit.git
3-
RUN mkdir /output && cd rust-audit && cargo build && cp target/debug/hello-auditable /output
1+
FROM rust:1.62.1-bullseye as builder
2+
RUN git clone https://github.com/rust-secure-code/cargo-auditable.git
3+
WORKDIR /cargo-auditable/cargo-auditable
4+
RUN cargo build
5+
WORKDIR /cargo-auditable/cargo-auditable/tests/fixtures/workspace
6+
RUN /cargo-auditable/target/debug/cargo-auditable auditable build
47
FROM scratch
5-
COPY --from=builder /output /
8+
COPY --from=builder \
9+
/cargo-auditable/cargo-auditable/tests/fixtures/workspace/target/debug/crate_with_features_bin \
10+
/crate_with_features_bin

0 commit comments

Comments
 (0)