Skip to content

Commit 73f2576

Browse files
committed
NeoEden : add a set of sample tests
Signed-off-by: Shahriyar Jalayeri <[email protected]>
1 parent ec9efb1 commit 73f2576

File tree

13 files changed

+3341
-116
lines changed

13 files changed

+3341
-116
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ install: build
105105

106106
build: $(BIN) $(EMPTY_DRIVE).raw $(EMPTY_DRIVE).qcow2 $(EMPTY_DRIVE).qcow $(EMPTY_DRIVE).vmdk $(EMPTY_DRIVE).vhdx $(LINUXKIT)
107107
$(LOCALBIN): $(BINDIR) pkg/eden/*.go
108-
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags "-s -w" -o $@ pkg/eden/*.go
108+
cd pkg/eden && CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags "-s -w" -o ../../$@ *.go
109109
mkdir -p dist/scripts/shell
110110
cp -r shell-scripts/* dist/scripts/shell/
111111

go.work

Lines changed: 0 additions & 3 deletions
This file was deleted.

go.work.sum

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/README.md

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +0,0 @@
1-
# Eden Integration Tests
2-
3-
This directory contains a series of integration tests that meet the
4-
[eden task API](../docs/task-writing.md), and thus can be launched using
5-
`eden test`. Each subdirectory contains an individual test suite with one or
6-
more tests.
7-
8-
The general principles for integration testing of EVE are available at
9-
[EVE+Integration+Testing](https://wiki.lfedge.org/display/EVE/EVE+Integration+Testing)
10-
11-
The testing workflow for CI/CD of this eden project is at [workflow/README.MD](workflow/README.MD)
12-
13-
## Running Integration Tests
14-
15-
You can run either the entire suite of tests in this repository, or an
16-
individual test or suite.
17-
18-
### Running The Entire Test Suite
19-
20-
To run the entire suite of integration tests, run either:
21-
22-
* `make test` in the root of this repository
23-
* `make test` in this `tests/` directory
24-
25-
### Running Individual Tests
26-
27-
To run any single suite of integration tests, launch them like any other
28-
[eden test/task](../docs/test-running.md):
29-
30-
```console
31-
eden test tests/testdir/
32-
```
33-
34-
You also can run `make test` in any individual test suite directory.
35-
36-
If you want to run one specific test, run:
37-
38-
```console
39-
eden test tests/testdir/ -t <TestName>
40-
```
41-
42-
See the [documentation for running eden tests](../docs/test-running.md) for
43-
more options.
44-
45-
## Building Integration Tests
46-
47-
The integration tests under `tests/` ship as source code. If you want to
48-
run them, you will need to build them. You can do this in one of several ways:
49-
50-
* To build an individual test, in its directory, run `make build`
51-
* To build all tests, in this directory `tests/`, run `make build`
52-
* To build all tests, in the root directory of the `eden` repository, run one of:
53-
* `make build-tests` - builds `eden` and all integration tests
54-
* `make testbin` - builds all integration tests
55-
56-
## Writing Integration Tests
57-
58-
### Test Suite Structure
59-
60-
Each test suite, in its own directory, must implement the
61-
[eden task API](../docs/test-writing.md), and thus contains, at least:
62-
63-
* the configuration file `eden-config.yml` with the corresponding fields
64-
* `eden.test-bin` - references the name of the binary built by `make build`
65-
* `eden.test-script` - references the test script in the test directory
66-
* a test script
67-
68-
In addition, each directory, in order to be part of the integration test suite,
69-
contains a Makefile with at least the following targets:
70-
71-
* `build` - build the test binary, if any, and places it in a directed bindir
72-
* `setup` - sets up the test environment
73-
* `clean` - removes any artifacts
74-
* `test` - executes the built test binary
75-
76-
The above targets must exist; if any is unneeded, it should be an empty target.
77-
78-
The bindir is expected to be `$(WORKDIR)/bin/`. For example, if the test binary
79-
is to be named `footest`, then the following should be the behaviour:
80-
81-
* `make build WORKDIR=/tmp` -> `/tmp/bin/footest`
82-
* `make build WORKDIR=/usr/local` -> `/usr/local/bin/footest`
83-
* `make build` -> whatever the `Makefile` uses as its default
84-
85-
These `Makefile` are not requirements for the general
86-
[eden task API](../docs/test-writing.md),but rather to be part of the
87-
standard set of integration tests that are launched by this repository.
88-
89-
### Test Suite Language
90-
91-
The tests in this directory are implemented in Golang. They meet
92-
the [Golang testing standard](https://golang.org/doc/code#Testing) by naming all
93-
test files `_test.go`, and thus can be compiled via `go test -c`. The compiled
94-
standalone binaries and individual tests/subtests from them can be combined in test scripts
95-
with the ability to configure runtime parameters and a specific
96-
EDEN configuration environment. In test scenarios and configuration files
97-
may be used standard Go templates machinery with some EDEN-specific extensions.
98-
99-
However, it is not _required_ that a test be built in go. Future tests in this
100-
directory may use different languages, provided that they meet the
101-
[eden task API](../docs/test-writing.md) and the `Makefile` structure.
102-
103-
## Useful links
104-
105-
* [EVE+Integration+Testing](https://wiki.lfedge.org/display/EVE/EVE+Integration+Testing)
106-
* [Eden testing README](https://github.com/lf-edge/eden/blob/master/tests/README.md)
107-
* [Description of existing tests](https://wiki.lfedge.org/display/EVE/Tests)

tests/app/.gitkeep

Whitespace-only changes.

tests/eve/Makefile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
DEBUG ?= "debug"
2+
3+
# HOSTARCH is the host architecture
4+
# ARCH is the target architecture
5+
# we need to keep track of them separately
6+
HOSTARCH ?= $(shell uname -m)
7+
HOSTOS ?= $(shell uname -s | tr A-Z a-z)
8+
9+
# canonicalized names for host architecture
10+
override HOSTARCH := $(subst aarch64,arm64,$(subst x86_64,amd64,$(HOSTARCH)))
11+
12+
# unless otherwise set, I am building for my own architecture, i.e. not cross-compiling
13+
# and for my OS
14+
ARCH ?= $(HOSTARCH)
15+
OS ?= $(HOSTOS)
16+
17+
# canonicalized names for target architecture
18+
override ARCH := $(subst aarch64,arm64,$(subst x86_64,amd64,$(ARCH)))
19+
20+
WORKDIR ?= $(CURDIR)/../../dist
21+
TESTDIR := tests/$(shell basename $(CURDIR))
22+
BINDIR := $(WORKDIR)/bin
23+
DATADIR := $(WORKDIR)/$(TESTDIR)/
24+
BIN := eden
25+
LOCALBIN := $(BINDIR)/$(BIN)-$(OS)-$(ARCH)
26+
TESTNAME := eden.eve
27+
TESTBIN := $(TESTNAME).testsuite
28+
LOCALTESTBIN := $(TESTBIN)-$(OS)-$(ARCH)
29+
.DEFAULT_GOAL := help
30+
31+
clean:
32+
rm -rf $(LOCALTESTBIN) $(BINDIR)/$(TESTBIN) $(CURDIR)/$(TESTBIN) $(BINDIR)/$(TESTBIN)
33+
34+
$(BINDIR):
35+
mkdir -p $@
36+
$(DATADIR):
37+
mkdir -p $@
38+
39+
test:
40+
$(LOCALBIN) test $(CURDIR) -v $(DEBUG)
41+
42+
build: setup
43+
44+
testbin: $(TESTBIN)
45+
$(LOCALTESTBIN): $(BINDIR) *.go
46+
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go test -c -ldflags "-s -w" -o $@ *.go
47+
48+
$(TESTBIN): $(LOCALTESTBIN)
49+
ln -sf $(LOCALTESTBIN) $(CURDIR)/$(TESTBIN)
50+
51+
setup: testbin $(BINDIR) $(DATADIR)
52+
mv $(LOCALTESTBIN) $(CURDIR)/$(TESTBIN) $(BINDIR)
53+
54+
debug:
55+
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go test -c -gcflags "all=-N -l" -o $@ *.go
56+
dlv dap --listen=:12345 --headless=true exec ./debug -- -test.v
57+
58+
.PHONY: test build setup clean all testbin debug
59+
60+
help:
61+
@echo "EDEN is the harness for testing EVE and ADAM"
62+
@echo
63+
@echo "This Makefile automates commons tasks of EDEN testing"
64+
@echo
65+
@echo "Commonly used maintenance and development targets:"
66+
@echo " build build test-binary (OS and ARCH options supported, for ex. OS=linux ARCH=arm64)"
67+
@echo " setup setup of test environment"
68+
@echo " test run tests"
69+
@echo " clean cleanup of test harness"
70+
@echo
71+
@echo "You need install requirements for EVE (look at https://github.com/lf-edge/eve#install-dependencies)."
72+
@echo "You need access to docker socket and installed qemu packages."

tests/eve/go.mod

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
module eve_test
2+
3+
go 1.22.5
4+
5+
replace github.com/lf-edge/eden/pkg/eden => ../../pkg/eden
6+
7+
replace github.com/lf-edge/eden/sdn/vm => ../../pkg/sdn/vm
8+
9+
replace github.com/lf-edge/eve/libs/depgraph => github.com/lf-edge/eve/libs/depgraph v0.0.0-20220711144346-0659e3b03496
10+
11+
require (
12+
github.com/bloomberg/go-testgroup v1.1.1
13+
github.com/lf-edge/eden/pkg/eden v0.0.0-00010101000000-000000000000
14+
github.com/sirupsen/logrus v1.9.3
15+
)
16+
17+
require (
18+
cloud.google.com/go/auth v0.9.3 // indirect
19+
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
20+
cloud.google.com/go/compute/metadata v0.5.0 // indirect
21+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
22+
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect
23+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
24+
github.com/Insei/rolgo v0.0.2 // indirect
25+
github.com/Microsoft/go-winio v0.6.2 // indirect
26+
github.com/Microsoft/hcsshim v0.11.7 // indirect
27+
github.com/amitbet/vncproxy v0.0.0-20200118084310-ea8f9b510913 // indirect
28+
github.com/beorn7/perks v1.0.1 // indirect
29+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
30+
github.com/containerd/cgroups v1.1.0 // indirect
31+
github.com/containerd/containerd v1.7.22 // indirect
32+
github.com/containerd/containerd/api v1.7.19 // indirect
33+
github.com/containerd/continuity v0.4.2 // indirect
34+
github.com/containerd/errdefs v0.1.0 // indirect
35+
github.com/containerd/fifo v1.1.0 // indirect
36+
github.com/containerd/log v0.1.0 // indirect
37+
github.com/containerd/platforms v0.2.1 // indirect
38+
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
39+
github.com/containerd/ttrpc v1.2.5 // indirect
40+
github.com/containerd/typeurl/v2 v2.1.1 // indirect
41+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
42+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
43+
github.com/distribution/reference v0.6.0 // indirect
44+
github.com/docker/cli v27.1.1+incompatible // indirect
45+
github.com/docker/distribution v2.8.3+incompatible // indirect
46+
github.com/docker/docker v27.2.1+incompatible // indirect
47+
github.com/docker/docker-credential-helpers v0.7.0 // indirect
48+
github.com/docker/go-connections v0.5.0 // indirect
49+
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
50+
github.com/docker/go-metrics v0.0.1 // indirect
51+
github.com/docker/go-units v0.5.0 // indirect
52+
github.com/dustin/go-humanize v1.0.1 // indirect
53+
github.com/fatih/color v1.17.0 // indirect
54+
github.com/felixge/httpsnoop v1.0.4 // indirect
55+
github.com/fsnotify/fsnotify v1.7.0 // indirect
56+
github.com/go-logr/logr v1.4.2 // indirect
57+
github.com/go-logr/stdr v1.2.2 // indirect
58+
github.com/go-resty/resty/v2 v2.7.0 // indirect
59+
github.com/gogo/protobuf v1.3.2 // indirect
60+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
61+
github.com/golang/protobuf v1.5.4 // indirect
62+
github.com/google/go-cmp v0.6.0 // indirect
63+
github.com/google/go-containerregistry v0.20.2 // indirect
64+
github.com/google/s2a-go v0.1.8 // indirect
65+
github.com/google/uuid v1.6.0 // indirect
66+
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
67+
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
68+
github.com/gorilla/mux v1.8.1 // indirect
69+
github.com/hashicorp/hcl v1.0.0 // indirect
70+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
71+
github.com/klauspost/compress v1.17.4 // indirect
72+
github.com/lf-edge/eden/eserver v0.0.0-20240912155252-98f9e9d49af1 // indirect
73+
github.com/lf-edge/eden/sdn/vm v0.0.0-00010101000000-000000000000 // indirect
74+
github.com/lf-edge/edge-containers v0.0.0-20240207093504-5dfda0619b80 // indirect
75+
github.com/lf-edge/eve-api/go v0.0.0-20240829123634-7c8ebda876ff // indirect
76+
github.com/lf-edge/eve/libs/depgraph v0.0.0-20220711144346-0659e3b03496 // indirect
77+
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
78+
github.com/magiconair/properties v1.8.7 // indirect
79+
github.com/mattn/go-colorable v0.1.13 // indirect
80+
github.com/mattn/go-isatty v0.0.20 // indirect
81+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
82+
github.com/mcuadros/go-lookup v0.0.0-20230627150232-5415b5b32da8 // indirect
83+
github.com/mitchellh/go-homedir v1.1.0 // indirect
84+
github.com/mitchellh/mapstructure v1.5.0 // indirect
85+
github.com/moby/docker-image-spec v1.3.1 // indirect
86+
github.com/moby/locker v1.0.1 // indirect
87+
github.com/moby/patternmatcher v0.6.0 // indirect
88+
github.com/moby/sys/mountinfo v0.6.2 // indirect
89+
github.com/moby/sys/sequential v0.5.0 // indirect
90+
github.com/moby/sys/signal v0.7.0 // indirect
91+
github.com/moby/sys/user v0.3.0 // indirect
92+
github.com/moby/sys/userns v0.1.0 // indirect
93+
github.com/moby/term v0.5.0 // indirect
94+
github.com/nerd2/gexto v0.0.0-20190529073929-39468ec063f6 // indirect
95+
github.com/opencontainers/go-digest v1.0.0 // indirect
96+
github.com/opencontainers/image-spec v1.1.0 // indirect
97+
github.com/opencontainers/runtime-spec v1.1.0 // indirect
98+
github.com/opencontainers/selinux v1.11.0 // indirect
99+
github.com/packethost/packngo v0.31.0 // indirect
100+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
101+
github.com/pkg/errors v0.9.1 // indirect
102+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
103+
github.com/prometheus/client_golang v1.17.0 // indirect
104+
github.com/prometheus/client_model v0.5.0 // indirect
105+
github.com/prometheus/common v0.44.0 // indirect
106+
github.com/prometheus/procfs v0.11.1 // indirect
107+
github.com/redis/go-redis/v9 v9.6.1 // indirect
108+
github.com/sagikazarmark/locafero v0.4.0 // indirect
109+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
110+
github.com/satori/go.uuid v1.2.0 // indirect
111+
github.com/sourcegraph/conc v0.3.0 // indirect
112+
github.com/spf13/afero v1.11.0 // indirect
113+
github.com/spf13/cast v1.6.0 // indirect
114+
github.com/spf13/pflag v1.0.5 // indirect
115+
github.com/spf13/viper v1.19.0 // indirect
116+
github.com/stretchr/testify v1.9.0 // indirect
117+
github.com/subosito/gotenv v1.6.0 // indirect
118+
github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef // indirect
119+
github.com/vbatts/tar-split v0.11.3 // indirect
120+
go.opencensus.io v0.24.0 // indirect
121+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
122+
go.opentelemetry.io/otel v1.29.0 // indirect
123+
go.opentelemetry.io/otel/metric v1.29.0 // indirect
124+
go.opentelemetry.io/otel/trace v1.29.0 // indirect
125+
go.uber.org/atomic v1.9.0 // indirect
126+
go.uber.org/multierr v1.9.0 // indirect
127+
golang.org/x/crypto v0.27.0 // indirect
128+
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
129+
golang.org/x/net v0.29.0 // indirect
130+
golang.org/x/oauth2 v0.23.0 // indirect
131+
golang.org/x/sync v0.8.0 // indirect
132+
golang.org/x/sys v0.25.0 // indirect
133+
golang.org/x/term v0.24.0 // indirect
134+
golang.org/x/text v0.18.0 // indirect
135+
google.golang.org/api v0.197.0 // indirect
136+
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect
137+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
138+
google.golang.org/grpc v1.66.1 // indirect
139+
google.golang.org/protobuf v1.34.2 // indirect
140+
gopkg.in/ini.v1 v1.67.0 // indirect
141+
gopkg.in/yaml.v2 v2.4.0 // indirect
142+
gopkg.in/yaml.v3 v3.0.1 // indirect
143+
oras.land/oras-go v1.2.6 // indirect
144+
)

0 commit comments

Comments
 (0)