tests: cleanup test directory

- add a `pkg` directory for packages
- add a `cases` directory for yml files

Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
Dave Tucker
2017-04-12 11:20:11 +01:00
parent edb909567c
commit 05767273f3
25 changed files with 5 additions and 5 deletions

3
test/pkg/virtsock/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
/bin
/virtsock.tag
/hash

View File

@@ -0,0 +1,14 @@
FROM linuxkit/go-compile:4513068d9a7e919e4ec42e2d7ee879ff5b95b7f5@sha256:bdfadbe3e4ec699ca45b67453662321ec270f2d1a1dbdbf09625776d3ebd68c5 AS virtsock-build
ENV VIRTSOCK_COMMIT=6b4dec728264e07c41e108caebd6bc2b72559a5f
RUN mkdir -p $GOPATH/src/github.com/rneugeba && \
cd $GOPATH/src/github.com/rneugeba && \
git clone https://github.com/rneugeba/virtsock.git
WORKDIR $GOPATH/src/github.com/rneugeba/virtsock
RUN git checkout $VIRTSOCK_COMMIT
RUN make build/virtsock_stress.linux
RUN cp -a build/virtsock_stress.linux /virtsock_stress
FROM linuxkit/tini:6714d66b82b5397f497b2aa05764096ed1ffe7d7@sha256:ba594b96af6195737ce2df702196d7adea2cafde554e18940ee14ad575d27f3b
COPY --from=virtsock-build virtsock_stress bin/virtsock_stress
CMD ["/bin/tini", "/bin/virtsock_stress", "-s", "-v", "1"]

View File

@@ -0,0 +1,26 @@
.PHONY: tag push
IMAGE=test-virtsock
default: push
DEPS=Dockerfile Makefile
SHASUM=alpine:3.5
hash: $(DEPS)
find $^ -type f | xargs cat | DOCKER_CONTENT_TRUST=1 docker run --rm -i $(SHASUM) sha1sum | sed 's/ .*//' > $@
tag: hash
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
(docker build --no-cache -t $(IMAGE):build . && \
docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build || true
push: tag
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
docker push linuxkit/$(IMAGE):$(shell cat hash)
rm -f hash
clean:
rm -rf hash
docker rmi $(IMAGE):build || true
.DELETE_ON_ERROR:

View File

@@ -0,0 +1,33 @@
This directory contains the files to build and run a container containing the
virtio and Hyper-V socket stress tests. `../../cases/test-virtsock-server.yml` builds images which start the server inside the VM.
The client, to be run on the host as per this [README](https://github.com/rneugeba/virtsock/blob/master/examples/README.md), can be obtained compiled from [here](https://github.com/rneugeba/virtsock).
## How to use (on Windows)
- Build the images: `moby build tests/cases/test-virtsock-server.yml`
- Copy the `test-virtsock-server.iso` to a Windows system
- Create a Type 1 Hyper-V VM (called `virtsock`).
- No Disk or network required
- Add the ISO to the CDROM device
- Make sure you enable a named pipe for COM1 (call it `virtsock`)
- Start the VM
- Connect to the serial console (to get debug output) with `putty -serial \\.\pipe\virtsock`
Run the client:
```
$vmId = (get-vm virtsock).Id
.\virtsock_stress.exe -c $vmId -v 1 -c 1000000 -p 10
```
This creates `1000000` connections from `10` threads to the VM and
sends some random amount of data of the connection before tearing it
down. There are more options to change the behaviour.
## TODO
- Add scripts to create Hyper-V VM
- Enable virtio sockets in `moby run` with HyperKit
- Add some sample client YAML files which would connect from the VM to the host
- Hook up to CI for both HyperKit and Hyper-V