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

2401: Use different syntax #437

Merged
merged 4 commits into from
Feb 7, 2025
Merged

2401: Use different syntax #437

merged 4 commits into from
Feb 7, 2025

Conversation

allthesignals
Copy link
Contributor

Ticket

N/A

Changes

Simplifies the syntax (sort of) so that it's easier to run these rake commands against a deployed environment through our infra platform tooling

Context for reviewers

Instead of

bin/run-command --environment-variables '[{ "name" : "id", "value" : "1" }]' app env '["bin/rails", "users:promote_to_service_account"]'

It's

`bin/run-command app env '["bin/rails", "users:promote_to_service_account[123]"]'`

Acceptance testing

  • No acceptance testing needed
    • This change will not affect the user experience (bugfix, dependency updates, etc.)
  • Acceptance testing prior to merge
    • This change can be verified visually via screenshots attached below or by sending a link to a local development environment to the acceptance tester
    • Acceptance testing should be done by design for visual changes, product for behavior/logic changes, or both for changes that impact both.
  • Acceptance testing after merge
    • This change is hard to test locally, so we'll test it in the demo environment (deployed automatically after merge.)
    • Make sure to notify the team once this PR is merged so we don't inadvertently deploy the unaccepted change to production. (e.g. :alert: Deploy block! @ffs-eng I just merged PR [#123] and will be doing acceptance testing in demo - please don't deploy until I'm finished!)

user.reload
expect(user.is_service_account).to eq(true)
expect(user.api_access_tokens.count).to eq(1)
end

it "demotes a service account user and removes all access tokens" do
user = create(:user, :with_access_token, is_service_account: true)
ENV["id"] = user.id.to_s
Rake::Task['users:demote_service_account'].execute
Rake::Task['users:demote_service_account'].invoke(user.id.to_s)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these need to pass in the arguments as keywords (like .invoke(user_id: user.id.to_s))?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope they're positional when i tested it...

@allthesignals
Copy link
Contributor Author

Huh, these tests are failing again. flaky.

# Conflicts:
#	app/lib/tasks/users.rake
#	app/spec/lib/users_rake_spec.rb
@allthesignals allthesignals merged commit bfd308c into main Feb 7, 2025
15 checks passed
tdooner added a commit that referenced this pull request Feb 12, 2025
…ow-use-new-database

* origin/main:
  FFS-2408: Rename site_id to client_agency_id (#446)
  FFS-2351: Change calculation of account_count to be correct in filed events (#445)
  Patching vulnerabilities | esbuild, net-imap (#450)
  Address vulnerability (#443)
  fix: upgrade postcss from 8.5.0 to 8.5.1 (#441)
  fix: upgrade sass from 1.83.2 to 1.83.4 (#440)
  2401: Use different syntax (#437)
  updated tests for clarity
  fixed typo
  cleaned up based on PR comments
  removed trailing whitespace/rubocop fixes
  wrapped token creation for users.rake in a transaction, added test assertion to assure that the user api_access_tokens.count only changes by a factor of 1
  updated vitest to v 3.0.5 address failed security scan
  rename vitest
  add github action
  fixed postcss build error
  added .vitest to git ignore
  updated package.json to use module
  setup project to work with vitest and debugging
  remove employer_search.spec
  comment out test
  write test scripts for pinwheel.js
  update apiservice to fetchInternalApiService for clarity
  refactored fetch into its own file
  refactored code to be a little more self evident
  remove outdated snapshots
  comment
  refactored api calls with tests
  added tests for trackUserAction api call
  move trackUserAction out of pinwheel into analytics file
  minor changes
  stub for employersearch test
  installed vitest
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.

2 participants