Skip to content

Commit

Permalink
Get the tests nearly running in docker (#144)
Browse files Browse the repository at this point in the history
* Get the foundation set up

* Get the tests nearly running in docker
  • Loading branch information
UnstoppableMango authored Aug 16, 2024
1 parent b7fbbeb commit d231e51
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
!bin/
!gen/
!provider/
!tests/
!examples/
!nuget/
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ $(GO_MODULES:%=.make/tidy/%): .make/tidy/%: $(addprefix %/,go.mod go.sum)
docker build ${WORKING_DIR} -f $< --target test -t ${PROVISIONER_NAME}:test
@touch $@

.make/sdk_docker: tests/sdk/Dockerfile .dockerignore $(PROVIDER_SRC) bin/$(PROVIDER)
docker build ${WORKING_DIR} -f $< -t sdk-test:dotnet
@touch $@
.test/sdk_docker: .make/sdk_docker
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock sdk-test:dotnet

.make/examples/%: examples/yaml/** bin/$(PROVIDER)
rm -rf ${WORKING_DIR}/examples/$*
$(PULUMI) convert \
Expand Down
33 changes: 33 additions & 0 deletions tests/sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# syntax=docker/dockerfile:1
ARG SDK=dotnet
FROM --platform=$BUILDPLATFORM pulumi/pulumi-${SDK}:3.129.0-debian
ARG SDK=dotnet
ARG TARGETOS
ARG TARGETARCH

WORKDIR /usr/local
RUN curl --fail -L -o- https://go.dev/dl/go1.23.0.${TARGETOS}-${TARGETARCH}.tar.gz | tar -zxv
ENV GOBIN=/usr/local/bin
ENV PATH=${PATH}:/usr/local/go/bin:${GOBIN}
RUN go install github.com/onsi/ginkgo/v2/ginkgo@v2

WORKDIR /work
COPY gen/go.* ./gen/
COPY tests/go.* ./tests/
COPY provider/go.* ./provider/

WORKDIR /work/tests
RUN go mod download

WORKDIR /work
COPY gen/ ./gen/
COPY examples/${SDK}/ ./examples/${SDK}/
COPY tests/ ./tests
COPY provider/ ./provider/
COPY nuget/ /root/.pulumi-dev/nuget/
RUN dotnet nuget add source /root/.pulumi-dev/nuget/ --name docker
COPY bin/pulumi-resource-baremetal ./bin/

WORKDIR /work/tests/sdk
ENTRYPOINT [ "ginkgo" ]
CMD [ "run", "-v", "--silence-skips" ]
4 changes: 2 additions & 2 deletions tests/sdk/sdk_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func TestSdk(t *testing.T) {

var _ = DescribeSdk("dotnet", func(base integration.ProgramTestOptions) integration.ProgramTestOptions {
return base.With(integration.ProgramTestOptions{
Dir: path.Join("..", "..", "examples", "dotnet"),
DotNetBin: path.Join(wd, "bin", "dotnet", "dotnet"),
Dir: path.Join("..", "..", "examples", "dotnet"),
// DotNetBin: path.Join(wd, "bin", "dotnet", "dotnet"),
Dependencies: []string{"UnMango.Baremetal"},
})
})
Expand Down

0 comments on commit d231e51

Please sign in to comment.