Skip to content

Eden to evetest: rewrite networking, security, apps, lps and storage tests - #6244

Merged
rene merged 9 commits into
lf-edge:masterfrom
milan-zededa:eden-to-evetest
Aug 6, 2026
Merged

Eden to evetest: rewrite networking, security, apps, lps and storage tests#6244
rene merged 9 commits into
lf-edge:masterfrom
milan-zededa:eden-to-evetest

Conversation

@milan-zededa

@milan-zededa milan-zededa commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

Rewrites a batch of Eden E2E test scenarios (networking, security, apps, LPS, upgrade, storage)
as native Go tests in the evetest framework, plus some framework/library enhancements
and one SDN bugfix needed to support them.

Commits

  • zedrouter, zedagent: rename NI status field to CombinedNTPServers
    NetworkInstanceConfig.NtpServers (the NI's own raw configured list) and
    NetworkInstanceStatus.NTPServers (the combined NI+port list zedrouter
    actually maintains) differed only by case, so zedagent's reporting code
    silently picked up the wrong one via field promotion through the embedded
    config struct. Renamed the status field to CombinedNTPServers and fixed
    zedagent to publish it.

  • evetest/sdn: fix dnsmasq router option not being suppressed
    A DHCP server config with GatewayIPv4 left nil (the documented way to
    make clients skip installing a default IPv4 route) simply omitted the
    dhcp-option=option:router line instead of explicitly suppressing it.
    dnsmasq's own default, absent an explicit override, is to advertise its
    own listening address on that subnet as the router, so clients still
    received one anyway.

  • evetest: framework/library enhancements
    Adds the EdgeDevice/EdgeCluster/harness capabilities the test
    rewrites below need: flow-log streaming (IterateDeviceFlowLogs,
    SubscribeToDeviceFlowLogs, the gRPC server iterator, and the
    evetest eve flow-logs CLI subcommand), EdgeDevice: GetArch,
    PowerOff, PowerOn, WaitForClusterNodeIsReady,
    and EdgeDevice.DialViaSSH (an SSH-tunneled net.Conn, used to reach
    the Kubevirt VNC proxy which only binds to the device's loopback).
    Also removes the now-unused SkipIfHypervisorKubevirt helper (all tests
    now support running at-least single-node EVE-K).

  • evetest: rewrite eden test suites (networking, security, apps, lps, upgrade)
    The actual eden -> evetest ports:

    • networking: many new tests, now clearly surpassing eden in the coverage
      of EVE networking.
    • security: TestAppArmorEnabled (kernel AppArmor status) and
      TestVCom (vcomlink TPM-over-vsock request/response from inside a
      guest VM).
    • apps: TestVNC (console access, VM and container apps) and app
      purge.
    • LPS: local profile server scenarios (app/device local info,
      profile switching, radio silence).
    • upgrade: support upgrade scenario with OCI datastore.
  • evetest: port eden storage tests, add new datastore coverage
    Rewrite eden's storage/volume test suites as evetest tests under
    evetest/tests/storage/:
    - tests/eclient/testdata/mount.txt -> TestMountedVolumes
    - tests/eclient/testdata/disk.txt -> TestExtraDiskAttach
    - tests/volume/testdata/volumes_test.txt -> TestVolumes
    - tests/zfs/testdata/state_and_layout_check.txt -> TestZFSDiskLayout
    - tests/volume/testdata/volume_sftp.txt -> merged into
    TestSFTPDatastore (tests/networking/datastore_test.go), since it
    overlapped with the new datastore tests below

  • evetest: run an embedded OCI registry for container-image tests
    Both BaseOSDatastoreOCI upgrades and TestContainerRegistry previously
    required their target image to already be published to a real, externally
    reachable registry (Docker Hub), so they broke for an unpublished local/dev
    build and depended on the device having Internet access.

  • evetest: sweep stale img-cache-* dirs left by killed containers

This leaves only the "smoke" test suite as not yet ported from eden to evetest.

How to test and validate this PR

# networking
make evetest NAME=TestFlowLog
make evetest NAME=TestNetworkConfigFallback
make evetest NAME=TestPortFailover
make evetest NAME=TestIntermittentConnectivity
make evetest NAME=TestMgmtTrafficRoutedViaApp
make evetest NAME=TestNIReplace
make evetest NAME=TestMoveAppBetweenNIs
make evetest NAME=TestAirGapSwitchNI
make evetest NAME=TestLimitedIPSpace
make evetest NAME=TestDeviceNTPConfig
make evetest NAME=TestApplicationNTPConfig

# security
make evetest NAME=TestAppArmorEnabled
make evetest NAME=TestVCom

# apps
make evetest NAME=TestVNC
make evetest NAME=TestPurgeNeverActivatedApp

# lps (local profile server)
make evetest NAME=TestAppLocalInfo
make evetest NAME=TestDevLocalInfo
make evetest NAME=TestProfile
make evetest NAME=TestRadioSilence

# upgrade
EVETEST_DATASTORE_TYPE=OCI make evetest NAME=TestEVEUpgrade

# storage
make evetest NAME=TestVolumes
make evetest NAME=TestMountedVolumes
make evetest NAME=TestExtraDiskAttach
make evetest NAME=TestZFSDiskLayout

# datastore
make evetest NAME=TestHTTPDatastore
make evetest NAME=TestHTTPSDatastore
make evetest NAME=TestSFTPDatastore
make evetest NAME=TestContainerRegistry

Changelog notes

Fixed a bug where a network instance's device-level NTP servers (learned
from DHCP or configured directly on the port) were not included in the
NTP server list reported to the controller for apps attached to that
network instance -- only the network instance's own explicitly
configured NTP servers were. Apps now see the full, correct combined
list.

All other changes are test-only (evetest framework additions and eden
test-suite rewrites) plus one SDN test-harness bugfix; no other
user-facing EVE behavior changes.

PR Backports

- 17.0-stable: Eventually to be backported (the entire evetest dir).
- 16.0-stable: No, as evetest is not available there.
- 14.5-stable: No, as evetest is not available there.
- 13.4-stable: No, as evetest is not available there.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR
  • I've checked the boxes above, or I've provided a good reason why I didn't check them.

@milan-zededa
milan-zededa requested review from europaul and rene July 31, 2026 14:41
@milan-zededa milan-zededa added the testing New test or test framework changes label Jul 31, 2026
@milan-zededa

Copy link
Copy Markdown
Contributor Author

@claude

Comment thread evetest/ssh.go Dismissed
@claude

claude Bot commented Jul 31, 2026

Copy link
Copy Markdown

Claude finished @milan-zededa's task in 3m 45s —— View job


Code review

  • Read pillar changes (zedrouter / zedagent NTP rename)
  • Read SDN dnsmasq fix
  • Read evetest framework/library changes
  • Read test rewrites
  • Post review

I reviewed the production-code changes and the framework/library additions in depth, and scanned the test rewrites. This is a well-structured, thoroughly-commented PR.

Production code (the parts with user-facing impact) look correct:

  • The NTPServersCombinedNTPServers rename is complete and consistent — I confirmed no stale NetworkInstanceStatus.NTPServers references remain (the other .NTPServers hits are on unrelated types: port DhcpConfig, DHCPServer, monitorapi). The rename genuinely fixes the field-promotion ambiguity described in the commit, and since NetworkInstanceStatus is an ephemeral /run pubsub topic republished on boot, the JSON field rename carries no upgrade/persistence risk.
  • The dnsmasq fix (explicit dhcp-option=option:router to suppress the router option when GatewayIPv4 is nil) is correct — an empty-value option is dnsmasq's documented way to suppress the default.

One latent bug I flagged inline (framework code): the OCI-datastore image-ref split in UpgradeEVE uses strings.Cut (first colon), which mis-splits registry-with-port refs. Harmless for the Docker Hub refs the current test uses, but worth fixing to LastIndex.

Other things I checked and consider fine:

  • AdamClient.IterateDeviceFlowLogs / SubscribeToDeviceFlowLogs: goroutine lifecycle, unsubscribe idempotency (sync.Once), channel close, and streamCtx cancellation are all handled correctly; the reconnect loop mirrors the existing metrics-subscription pattern.
  • waitUntilAppState / WaitUntilAppIsRunning refactor (subscribe-before-snapshot, live flag to suppress replay logging, nil-timer guards during replay) is intricate but internally consistent.
  • Good incidental fix: ReadPublication persistent path corrected from /persistent/status//persist/status/.
  • dialViaSSH / sshTunnelConn.Close() correctly own and tear down the underlying SSH client. (Minor: the ctx arg isn't honored by ssh.Dial, which uses its own 5s timeout — not worth changing.)

No security or correctness concerns in the pillar changes. Nice work.
· eden-to-evetest

Comment thread evetest/edgedevice.go Outdated
@milan-zededa

Copy link
Copy Markdown
Contributor Author

@claude

@claude

claude Bot commented Jul 31, 2026

Copy link
Copy Markdown

Claude finished @milan-zededa's task in 2m 12s —— View job


Re-review

  • Re-read pillar changes (NTP rename)
  • Re-check framework/library changes (adam flow-logs, edgedevice, ssh)
  • Verify the strings.LastIndex fix landed
  • Scan new/rewritten test suites
  • Post findings

The one finding from my previous pass is resolved and I found nothing new that blocks. Summary below.

Fix confirmedUpgradeEVE now splits the OCI image reference with strings.LastIndex (edgedevice.go), so registry-with-port refs no longer mis-split. Good.

Production code (pillar) — re-verified correct:

  • The NTPServersCombinedNTPServers rename is complete. I re-grepped all of pkg/pillar: every remaining .NTPServers hit is on an unrelated type (DhcpConfig/port config, DHCPServer, monitorapi, kubevirt vendor) — no stale NetworkInstanceStatus.NTPServers references remain, so field promotion can no longer silently resolve to the NI-only config list. Since NetworkInstanceStatus is an ephemeral /run topic republished on boot, the JSON field rename carries no persistence/upgrade risk.
  • dnsmasq fix (explicit empty dhcp-option=option:router to suppress option 3 when GatewayIPv4 is nil) matches dnsmasq's documented suppression semantics.

Framework additions — checked, no issues:

  • IterateDeviceFlowLogs / SubscribeToDeviceFlowLogs: 404-on-empty handling, protojson decode loop, streamCtx cancellation, sync.Once unsubscribe, channel close, and the fixed-delay reconnect loop all mirror the existing metrics-subscription pattern correctly.
  • waitUntilAppState / WaitUntilAppIsRunning subscribe-before-snapshot refactor: the overlap window (a message landing between subscribe and the GET snapshot appears in both, but state application is idempotent) and the nil-timer guards during replay are internally consistent. nonDownloadStart is initialized to time.Now() at declaration and reset before the live phase, so nonDownloadElapsed can't be corrupted by replay — the "negligible elapsed" reasoning holds.
  • dialViaSSH / sshTunnelConn.Close() correctly own and tear down the underlying SSH client; scpFromEVE/scpToEVE now shell-escape the remote path (good catch for keys with spaces).

Not re-raising: the CodeQL InsecureIgnoreHostKey flag on ssh.go:86 — your justification (ephemeral per-test EVE VMs, shared throwaway key) is reasonable for test-only harness code.

No security or correctness concerns. LGTM.
· eden-to-evetest

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.47%. Comparing base (ca1b11f) to head (cf53db6).

Files with missing lines Patch % Lines
pkg/pillar/cmd/zedrouter/networkinstance.go 0.00% 2 Missing ⚠️
pkg/pillar/cmd/zedagent/handlemetrics.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6244      +/-   ##
==========================================
+ Coverage   24.12%   24.47%   +0.35%     
==========================================
  Files         512      522      +10     
  Lines       93594    95310    +1716     
==========================================
+ Hits        22576    23330     +754     
- Misses      69232    70012     +780     
- Partials     1786     1968     +182     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@milan-zededa
milan-zededa force-pushed the eden-to-evetest branch 2 times, most recently from 7f6e110 to 79a4d78 Compare August 3, 2026 10:53
@milan-zededa
milan-zededa marked this pull request as ready for review August 3, 2026 10:56
@milan-zededa
milan-zededa force-pushed the eden-to-evetest branch 3 times, most recently from 81ffe76 to 09567f0 Compare August 4, 2026 10:20

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yetus reports
| -1 | golangcilint | 8m 17s | The patch generated 24 new + 538
| | | | unchanged - 0 fixed = 562 total (was
| | | | 538)
but the summary and annotations appear to be showing unchanged files with yetus issues. @rene I see this with yetus on other PRs as well - as soon as there is a -1 vote we end up with a summary and annotations which do not relate to the diffs in the PR.

Needs to be rebased and conflicts resolved - hence "changes requested".

Also, how soon can we get the running of these tests into the EVE CI? And can we make that be included in the code coverage so we don't show zero coverage as we do for this PR?

@milan-zededa
milan-zededa force-pushed the eden-to-evetest branch 2 times, most recently from e65b78d to e7b6f78 Compare August 6, 2026 07:58
@github-actions
github-actions Bot requested a review from eriknordmark August 6, 2026 07:59
@milan-zededa milan-zededa changed the title Eden to evetest: rewrite networking, security, apps and lps tests Eden to evetest: rewrite networking, security, apps, lps and storage tests Aug 6, 2026
@milan-zededa

milan-zededa commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@eriknordmark @rene
I have rebased the PR to fix merge conflicts, added storage tests rewritten from eden to evetest, and addressed all Yetus issues relevant to this PR.
The PR is therefore ready for merge.

Also, how soon can we get the running of these tests into the EVE CI? And can we make that be included in the code coverage so we don't show zero coverage as we do for this PR?

We do not have enough hardware resources to run both eden and evetest. So we need to first complete the migration of tests from eden to evetest. The only remaining (after this PR) are smoke tests and one storage test, which Rene, Andrew and Paul are taking care of. Once that has completed, we can migrate to evetest.
We could also enable code coverage collection (it is already supported in evetest), but it will certainly have some effect on performance and test duration. Perhaps it makes sense to have this enabled only on some "large" workflow that would run all tests once per night for the master branch, as opposed to collecting it for every PR separately.

Comment thread evetest/localregistry.go Outdated
// published to a real, reachable registry -- see
// PushDockerImageToLocalRegistry.
func newLocalRegistryHandler() http.Handler {
return registry.New()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registry.New() in v0.14.0 hardcodes the in-memory blob handler, so the pushed image (an lfedge/eve image for the OCI upgrade variant -- hundreds of MB) stays in the harness heap for the whole process. TestUpgradeSuite runs all variants under a single Init, so it is still resident during the later ones.

Bumping go-containerregistry to >= v0.19.1 gets you registry.WithBlobHandler(registry.NewDiskBlobHandler(dir)), which would put the blobs under th.imgServerDir instead. Probably worth doing anyway now that the module is a direct dependency -- v0.14.0 is from early 2023.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread evetest/localregistry.go Outdated
// content tree) directly from evetest, without that image ever having been
// published to a real, reachable registry -- see
// PushDockerImageToLocalRegistry.
func newLocalRegistryHandler() http.Handler {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registry.New() defaults all of its loggers to log.New(os.Stderr, ...), so every manifest/blob request is printed outside logrus and outside the artifact dir, interleaved with go test output.

registry.Logger() exists in v0.14.0 -- passing one backed by the harness logger fixes it (needs a logger argument here).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it logs like this:

HARNESS  time="2026-08-06T12:55:18Z" level=debug msg="OCI Registry: GET /v2/lfedge/evetest-ubuntu-ctr/blobs/sha256:bfb639d8897b6a35afa63552a945cf1e821a2bd4722ae9c3f0d01f19e8e62664"
HARNESS  time="2026-08-06T12:55:18Z" level=debug msg="OCI Registry: GET /v2/"
HARNESS  time="2026-08-06T12:55:18Z" level=debug msg="OCI Registry: GET /v2/lfedge/evetest-ubuntu-ctr/blobs/sha256:ad8d8f2cc1c08a1b0f5ead34e57d34e28e7b9eb51e2a82c1cb8f3ef7bfb2d6a5"
HARNESS  time="2026-08-06T12:55:18Z" level=debug msg="OCI Registry: HEAD /v2/lfedge/evetest-ubuntu-ctr/blobs/sha256:bfb639d8897b6a35afa63552a945cf1e821a2bd4722ae9c3f0d01f19e8e62664"
HARNESS  time="2026-08-06T12:55:18Z" level=debug msg="OCI Registry: HEAD /v2/lfedge/evetest-ubuntu-ctr/blobs/sha256:1d2c5bc98e8170a8e5ce3776edba944097c26bc35fe7c52aa2a2ed905746325d"

Comment thread evetest/localregistry.go Outdated
th := getTestHarness()
log := th.log.WithField("component", "local-registry")

repo, tag, ok := strings.Cut(imageName, ":")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings.Cut splits at the first colon, whereas the code this replaces in UpgradeEVE used strings.LastIndex deliberately. A repo carrying a registry port (harbor.example.com:5000/lfedge/eve:1.2.3-kvm-amd64) now yields repo="harbor.example.com".

LastIndex alone would not be enough either -- the re-tag below would then produce 10.x.x.x:80/harbor.example.com:5000/.... Parsing with name.ParseReference and re-tagging from .Context().RepositoryStr() handles both, and name is already imported.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do something about the yetus issues against evetest? They might not have been introduced by this PR (and we have an issue with the summary/annotations being all over the place), but makes sense to take a look at the summary in https://github.com/lf-edge/eve/actions/runs/31085972149?pr=6244

Kick off regression tests for good measure.

@milan-zededa

Copy link
Copy Markdown
Contributor Author

Should we do something about the yetus issues against evetest? They might not have been introduced by this PR (and we have an issue with the summary/annotations being all over the place), but makes sense to take a look at the summary in https://github.com/lf-edge/eve/actions/runs/31085972149?pr=6244

Kick off regression tests for good measure.

I will address them at some point, but in a separate PR (there are 140 issues raised for evetest, mostly Error return value of <something> is not checked)

@rene

rene commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The yetus issue is related to an error with bufcompat plugin:

Failure: input contained 2 images, whereas against contained 1 images

We use --buf-basedir=/workspace/src/evetest but inside evetest we have more than one protbuf module:

  • evetest/grpcapi/eve-api
  • evetest/grpcapi/proto

That's why 2 images are generated, the plugin only supports check against one... I will open a PR with the fix, we should point only to evetest/grpcapi/proto

@milan-zededa

Copy link
Copy Markdown
Contributor Author

The yetus issue is related to an error with bufcompat plugin:

Failure: input contained 2 images, whereas against contained 1 images

We use --buf-basedir=/workspace/src/evetest but inside evetest we have more than one protbuf module:

* evetest/grpcapi/eve-api

* evetest/grpcapi/proto

That's why 2 images are generated, the plugin only supports check against one... I will open a PR with the fix, we should point only to evetest/grpcapi/proto

I tried to fix this some time ago, but could never avoid the -1 for bufcompat. Maybe your agent will do better job :)

@rene

rene commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Yetus fix: #6276

@rene

rene commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@milan-zededa Yetus fix is merged. You can rebase if you want.

milan-zededa and others added 9 commits August 6, 2026 16:20
ZInfoApp was not reporting all NTP servers for an application's network
instance: NetworkInstanceConfig.NtpServers (the NI's own raw configured
list) and NetworkInstanceStatus.NTPServers (the combined NI+port list
zedrouter actually maintains) differed only by case, so the reporting
code in zedagent silently picked up the wrong one via field promotion
through the embedded config struct.

Renamed the status field to CombinedNTPServers to make the two
unambiguous by name, and fixed zedagent to publish it.

Signed-off-by: Milan Lenco <milan@zededa.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
When a DHCP server's GatewayIPv4 is left nil (the documented way to make
clients not install a default IPv4 route), the config renderer simply
omitted the dhcp-option=option:router line instead of explicitly
suppressing it. dnsmasq's own default, absent an explicit override, is to
advertise its own listening address on that subnet as the router, so
clients still received one -- defeating the purpose of leaving
GatewayIPv4 unset.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
Add the EdgeDevice/EdgeCluster/harness capabilities needed by the
eden-to-evetest test rewrites:

- Flow-log streaming: AdamClient.IterateDeviceFlowLogs/
  SubscribeToDeviceFlowLogs, the corresponding gRPC server iterator, and
  the `evetest eve flow-logs` CLI subcommand.
- EdgeDevice.GetArch, PowerOff, PowerOn and WaitForClusterNodeIsReady.
- EdgeDevice.DialViaSSH (an SSH-tunneled net.Conn, used for reaching the
  Kubevirt VNC proxy which only binds to the device's loopback).

Also removes the now-unused SkipIfHypervisorKubevirt test-parameter
helper; its call sites move to an inline
`if hypervisor == evetest.HypervisorKubevirt` check in the test-suite
rewrite commit that follows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
…pgrade)

Port the corresponding eden E2E scenarios to the evetest Go framework
across networking (flow logs, DPC fallback/failover, intermittent
connectivity, mgmt traffic routed via an app-based NAT gateway, and
several smaller fixes), security (AppArmor status, vcomlink TPM-over-vsock),
apps (VNC console access, app purge), LPS and upgrade. Adds the
TwoMgmtPortsWithPublicNTP and MgmtViaAppTopology network models used by
the rewritten tests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
Rewrite eden's storage/volume test suites as evetest tests under
evetest/tests/storage/:
  - tests/eclient/testdata/mount.txt -> TestMountedVolumes
  - tests/eclient/testdata/disk.txt -> TestExtraDiskAttach
  - tests/volume/testdata/volumes_test.txt -> TestVolumes
  - tests/zfs/testdata/state_and_layout_check.txt -> TestZFSDiskLayout
  - tests/volume/testdata/volume_sftp.txt -> merged into
    TestSFTPDatastore (tests/networking/datastore_test.go), since it
    overlapped with the new datastore tests below

Additionally add datastore tests eden has no equivalent for at all:
TestHTTPDatastore, TestHTTPSDatastore and TestContainerRegistry,
exercising EVE's HTTP/HTTPS/container-registry datastore code paths
end to end (download, checksum verification, and the corresponding
negative paths: bad checksum, bad credentials, untrusted certificate,
missing object/tag).

To support all of the above, extend the evetest framework itself:
  - EdgeDeviceConfig gains a standalone (app-unreferenced) volume
    lifecycle -- AddVolume/AddBlankVolume/DeleteVolume -- and a Mounts
    field on ApplicationInstanceConfig to attach such volumes to an
    app, either as a mounted directory or (with an empty MountDir) as
    a raw block device.
  - RequireEdgeDevice gains ExtraDisks to provision additional virtio
    disks via the broker, needed for the ZFS layout test.
  - evetest's built-in image server gains HTTPS and SFTP listeners
    (harness.go, new sftpserver.go) alongside its existing plain HTTP
    server, so the new datastore tests are fully self-contained.
  - New CreateBlankImageFile/CreateRandomImageFile helpers generate
    test image content (real qemu-img disk images and random-content
    files, respectively) served by the built-in image server.

Signed-off-by: Milan Lenco <milan@zededa.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Both BaseOSDatastoreOCI upgrades and TestContainerRegistry previously
required their target image to already be published to a real, externally
reachable registry (Docker Hub), so they broke for an unpublished local/dev
build and depended on the device having Internet access.

- Add an embedded OCI registry (go-containerregistry's pkg/registry,
  in-memory), mounted at "/v2/" on the harness's existing image-server
  listeners alongside the HTTP/HTTPS/SFTP servers -- no new port or
  certificate needed (localregistry.go).
- PushDockerImageToLocalRegistry pulls an image into the local Docker daemon
  if not already present, then republishes it there. EVE is pointed at the
  registry's HTTPS listener, trusting the harness's own CA via a new
  DockerContainer.TrustedCACertsPEM field (mirrors
  HTTPStorage.HTTPSTrustedCACertsPEM, wired into DatastoreConfig.DsCertPEM).
- UpgradeEVE's OCI branch now publishes to this registry instead of assuming
  the target image is already published elsewhere, and fails fast with a
  clear error if BaseOSDatastoreOCI and the live-image transport
  (EVETEST_EVE_LIVE_IMAGE) are both requested together -- one wants a
  container image, the other a disk image, so the combination is
  unsupported.
- TestContainerRegistry now publishes its test image
  (lfedge/evetest-ubuntu-ctr:1.0) through the same registry instead of
  pulling it from the real Docker Hub, and no longer needs
  RequireInternetConnectivity{}.
- go.mod/go.sum: promotes go-containerregistry to a direct dependency
  (already present transitively). Uses its tarball package plus the
  already-used moby/moby/client for reading local images, rather than
  go-containerregistry's own daemon package, which would have pulled in a
  second, separate Docker client library and a much larger dependency bump.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
Each harness process gets its own img-cache-* directory under
$HOME/.evetest, normally removed in Close(). A container killed before
Close runs (SIGKILL, docker stop without a graceful shutdown) skips that
cleanup and leaks it forever. Init now removes any such directory whose
mtime is older than 3 days before creating its own.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
Log Close/Remove errors instead of discarding them in adam.go,
localregistry.go and sftpserver.go, and make Close() not return an
unused error. Also fix a possible nil-pointer dereference flagged in
buildMountRefs by adding explicit continue statements after Fatalf.

Signed-off-by: Milan Lenco <milan@zededa.com>
- Store registry blobs on disk (th.imgServerDir) via
  registry.NewDiskBlobHandler instead of keeping every pushed image
  resident in the harness process's memory for the life of the test
  binary. This matters most for TestUpgradeSuite, which runs every
  upgrade variant under a single Init and pushes a full EVE rootfs
  (hundreds of MB) each time. Bump go-containerregistry to v0.21.9 for
  registry.WithBlobHandler/NewDiskBlobHandler (added in v0.19.1);
  v0.14.0 was from early 2023, so go mod tidy also pulls in the
  resulting transitive dependency updates.
- Route the registry's manifest/blob request logging through the
  harness logger (debug level, since it logs every request) via
  registry.Logger, instead of registry.New's default of printing
  straight to stderr, outside logrus and outside the artifact dir.
- Parse PushDockerImageToLocalRegistry's imageName with name.NewTag
  instead of splitting on the first ":", so a registry host that
  carries its own port (e.g.
  "harbor.example.com:5000/lfedge/eve:1.2.3-kvm-amd64") is still split
  into the correct repository ("lfedge/eve") and tag, rather than
  mistaking the port for the tag separator.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
@milan-zededa

Copy link
Copy Markdown
Contributor Author

@milan-zededa Yetus fix is merged. You can rebase if you want.

@rene Rebased

@rene

rene commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Yetus passed. There is no reason to wait for Eden tests or builds since changes are only on evetest.

My bad, I forgot the small changes on pillar as well and just merged. @milan-zededa will keep an eye on the tests.

@rene
rene merged commit 75e4099 into lf-edge:master Aug 6, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing New test or test framework changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants