Repository navigation
test(cpdaemon,cpgolib): check cpm config mapping, buffer sizing, sync state and handshake - #316
Merged
Merged
Conversation
… state and handshake gremlins left many mutants alive in cpdaemon/pkg/cpm and cpgolib/cpworker (#243 item 6): branches the tests run but whose result they never check. New and extended tests: - worker_task_builder: the VXLAN tag format follows apiVersion (vni1 with the service tag or 0xFFFFFF; vni2 with domain/point/extension flag, VXLAN-WIRE-FORMAT.md sections 5, 8, 9); rate limit 0 left unset; vxlan port, zmq service tag and file dump interval reach the output; packetSplitBytes 0 accepted; --nofilter without bind_device rejected. - worker_mgr: auto_nic_buffer splits the memory limit over the tasks, CPM memLimit overrides the default only when > 0, too little memory is an error; the pipeline section gets the memory left after the libpcap buffers but at least MinBufferSizeMb; cpu_affinity passed through; the control socket directory is created before the worker starts. - syncer: register sends start seconds plus microseconds; a new daemon id stops the worker and resets the sync state; a failing strategy sync is retried SyncStrategyMaxRetries times; metrics sampling microseconds stay below 1e6; the uuid file is reused and an empty one refilled; IncludingNICs limits the registered interfaces. - client: SetDefaults keeps set values; Register sends labels and networkInterfaces as [] and fails on a non-2xx status or a body code >= 400. models: HasInstances. utils: splitArgs drops empty arguments. synclog: level threshold, entry microseconds. - cpgolib: Dial fails when the handshake reply is not OK or not JSON; a timeout of 0 falls back to DefaultTimeout. gremlins test efficacy (v0.5.0, before -> after): - cpdaemon/pkg/cpm: 63.4% -> 83.3%. The rest are error branches that only log, CPU/memory figures read from the live process, log-only formatting, and equivalent mutants. - cpgolib/cpworker: 76.0% -> 85.7%. The rest are equivalent mutants and the omitted empty "arguments" field, which cpworker never reads. Refs #243
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gremlins left many mutants alive in
cpdaemon/pkg/cpmandcpgolib/cpworker(#243 item 6): the tests run these branches but never check their result. Re-measured on0.9.x(c4e1a8e9), test efficacy was 63.4% forpkg/cpm(79 surviving mutants) and 76.0% forcpgolib/cpworker(6 surviving). Among the gaps:vni1/vni2) a CPM strategy produces, and the0xFFFFFFfallback without a service tag;Change
Tests only, no product code changes.
worker_task_builder: the VXLAN tag format followsapiVersion(docs/VXLAN-WIRE-FORMAT.md§5, §8, §9):vni1carries the service tag, or0xFFFFFFwithout one;vni2carries domain, point and extension flag, falling back to domain 1 and point 1. A rate limit of 0 is left unset. The vxlan port, zmq service tag and file dump interval reach the output.packetSplitBytes0 is accepted.--nofilterwithoutbind_deviceis rejected.worker_mgr:auto_nic_buffersplits the memory limit over the tasks. CPMmemLimitoverrides the default only when > 0. Too little memory is an error. The pipeline section gets the memory left after the libpcap buffers, but at leastMinBufferSizeMb.cpu_affinityis passed through. The control socket directory is created before the worker starts.syncer: register sends the start time as seconds plus microseconds. A new daemon id stops the worker and resets the sync state. A failing strategy sync is retriedSyncStrategyMaxRetriestimes. The metrics sampling microseconds stay below 1e6. The uuid file is reused, and an empty one is refilled.IncludingNICslimits the registered interfaces.client:SetDefaultskeeps values that are set.RegistersendslabelsandnetworkInterfacesas[], and fails on a non-2xx status or a bodycode>= 400.models,utils,synclog:HasInstances;splitArgsdrops empty arguments; the log level threshold; log entry microseconds.cpgolib/cpworker:Dialfails when the handshake reply is not OK or not JSON. A timeout of 0 falls back toDefaultTimeout.Not changed, as discussed in #243:
argumentsfield in cpgolib requests: cpworker never readsarguments(unix-manager.c), so a test would pin serialization without a behaviour behind it.Tests
gremlins v0.5.0 test efficacy, before → after:
cpdaemon/pkg/cpm: 63.4% → 83.3% (measured before the last vni2 fallback case). The rest are the categories above plus equivalent mutants.cpgolib/cpworker: 76.0% → 85.7%. The rest are 3 equivalent mutants plus theargumentscase.gremlins copies the module to a temporary directory, which breaks
cpdaemon's relativereplace => ../cpgolib: every mutant then fails to compile and is counted as killed. The numbers above come from a copy with an absolutereplace.Suites run:
go vet ./...andgo test ./...forcpdaemonandcpgolibon macOS: pass.pkg/cpmandcpgolib/cpworkeron Ubuntu 24.04: pass.Refs #243