Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to update and delete environment vars #766

Open
wants to merge 3 commits into
base: main-enterprise
Choose a base branch
from

Conversation

klutchell
Copy link
Contributor

No description provided.

Signed-off-by: Kyle Harding <kyle@balena.io>
Signed-off-by: Kyle Harding <kyle@balena.io>
Signed-off-by: Kyle Harding <kyle@balena.io>
@Copilot Copilot bot review requested due to automatic review settings February 27, 2025 20:52

Choose a reason for hiding this comment

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

PR Overview

This PR adds test coverage for updating and deleting environment variables and refines the handling of API requests in the Environments plugin.

  • Added tests to detect divergence when environment variables require updates or deletion.
  • Adjusted filtering logic and API request handling in lib/plugins/environments.js to support the new behaviors.

Reviewed Changes

File Description
test/unit/lib/plugins/environments.test.js Added tests for updating and deleting environment variables.
lib/plugins/environments.js Updated API request calls, filtering logic for variable updates, and minor code formatting improvements.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

lib/plugins/environments.js:178

  • [nitpick] Confirm that updating existingVariables by filtering out variables with matching names (using !==) is the intended behavior to avoid deleting variables that have been processed during an update. Additionally, verify that the lowercasing of variable names is consistently handled across both the configuration and API response.
existingVariables = existingVariables.filter(_var => _var.name !== variable.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant