test(telemetry): add unit tests for telemetry_cmd.rs (fixes #1254)#2880
Open
jlaportebot wants to merge 3 commits into
Open
test(telemetry): add unit tests for telemetry_cmd.rs (fixes #1254)#2880jlaportebot wants to merge 3 commits into
jlaportebot wants to merge 3 commits into
Conversation
Addresses rtk-ai#1254: Add unit tests for telemetry_cmd.rs GDPR consent, erasure, and device identity. Tests cover: - maybe_ping() consent guard (None, false, true-but-disabled) - send_erasure_request() X-RTK-Token header, error handling, timeout, malformed response - run_forget() deletes .device_salt, history.db, preserves device hash for erasure call - prompt_telemetry_consent() no-re-ask, CI/CD silent mode, TTY-only prompting - save_telemetry_consent() atomic write, preserves other config fields Added RTK_DATA_DIR and RTK_CONFIG_DIR environment variable support to config loading and telemetry file paths for test isolation.
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.
Summary
Adds comprehensive unit tests for addressing issue #1254 (follow-up from #1181 which added the subcommands implementing GDPR consent and erasure flow).
Test Coverage
consent guard (4 tests)
(4 tests)
(7 tests)
(4 tests)
(2 tests)
Additional telemetry status tests (4 tests)
enable :
enable [
enable alias
enable bg
enable bind
enable break
enable builtin
enable caller
enable cd
enable command
enable compgen
enable complete
enable compopt
enable continue
enable declare
enable dirs
enable disown
enable echo
enable enable
enable eval
enable exec
enable exit
enable export
enable false
enable fc
enable fg
enable getopts
enable hash
enable help
enable history
enable jobs
enable kill
enable let
enable local
enable logout
enable mapfile
enable popd
enable printf
enable pushd
enable pwd
enable read
enable readarray
enable readonly
enable return
enable set
enable shift
enable shopt
enable source
enable suspend
enable test
enable times
enable trap
enable true
enable type
enable typeset
enable ulimit
enable umask
enable unalias
enable unset
enable wait requires interactive TTY (fails in CI)
Changes to Support Testing
Modified source to respect and environment variables for test isolation:
Quality Gates
Related Issues
Fixes #1254 (Add unit tests for telemetry_cmd.rs follow-up from #1181)