weixin_39661589
weixin_39661589
2020-12-29 08:56

Store generated user data in local sqlite db

Why

  • We need to generate users and reuse those credentials for load testing. This modifies the existing user generator script to also store the data to the db.

How

  • Add sqlite and write users to db as they are generated.

该提问来源于开源项目:18F/identity-idp

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

10条回答

  • weixin_39604819 weixin_39604819 4月前

    I think it looks OK, but let's get or to take a look

    点赞 评论 复制链接分享
  • weixin_39759995 weixin_39759995 4月前

    The idea here is to create a sqlite database with the seed users that you can pull off of the host?

    点赞 评论 复制链接分享
  • weixin_39661589 weixin_39661589 4月前

    Correct, we need some existing users to test things like signins, pw resets, account restore, etc.

    点赞 评论 复制链接分享
  • weixin_39759995 weixin_39759995 4月前

    :+1.

    I think this is okay to merge even though circle is 🔴 since that looks like an issue with capybara talking to the static site and not your change.

    点赞 评论 复制链接分享
  • weixin_39806818 weixin_39806818 4月前

    Doesn't the existing script already store the users in the DB? What is the advantage of storing the users both in Postgres and in Sqlite?

    点赞 评论 复制链接分享
  • weixin_39661589 weixin_39661589 4月前

    We need them local to the locust load testing script which does not have access to the RDS instance. We need this to test signins/pw changes and other functions that you can only do with existing accounts.

    点赞 评论 复制链接分享
  • weixin_39806818 weixin_39806818 4月前

    Forgive me for being obtuse, but could you please point out which part of my thinking is flawed?

    The way I understand it, the script simulates users by making HTTP requests to a particular server. In this case, I believe the server is staging. If you run rake dev:random_users NUM_USERS=1000 SCRYPT_COST='800$8$1$' ATTRIBUTE_COST='800$8$1$' on staging, you will end up with 1000 existing users with the email address testuser1.com through testuser1000.com, the password salty pickles, and the phone number +1 (415) 555-0001 through +1 (415) 555-1000.

    In the locust script, is it not possible to tell it to sign in with one of these 1000 existing users?

    点赞 评论 复制链接分享
  • weixin_39806818 weixin_39806818 4月前

    Sorry, that attribute cost is wrong. It should not be specified (so that it matches what's on the server). The correct command is bin/rake dev:random_users NUM_USERS=1000 (or however many users you want).

    点赞 评论 复制链接分享
  • weixin_39604819 weixin_39604819 4月前

    I think putting these users in a sqlite DB was my idea, but now I'm thinking is right and we can probably just pull them, so long as we know what to expect. Maybe this isn't needed.

    点赞 评论 复制链接分享
  • weixin_39661589 weixin_39661589 4月前

    Moncef, you're right, we don't need the DB if we're only testing sign ins. We may need this functionality when we test restoring accounts from a personal key. For now that's a low priority and I think we can work with using the calculated usernames and shared password for the load testing accounts.

    I'm going to close the issue for now and will reopen if we end up needed db support.

    点赞 评论 复制链接分享

相关推荐