-
Notifications
You must be signed in to change notification settings - Fork 689
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
Include various client related strings in test data #5224
Conversation
This pull request introduces 1 alert when merging fd8a0f2 into ecf6255 - view on LGTM.com new alerts:
|
fd8a0f2
to
69c070f
Compare
This pull request introduces 1 alert when merging 69c070f into ecf6255 - view on LGTM.com new alerts:
|
69c070f
to
211a394
Compare
This pull request introduces 1 alert when merging 211a394 into ecf6255 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this CLIENT_TEST_DATA
env var solution. Nice work!
Up to you. I think since this is not default, it would be great to add all the test strings from https://github.com/freedomofpress/securedrop-client/wiki/Message-Test-Data and also maybe a couple from https://github.com/minimaxir/big-list-of-naughty-strings/blob/master/blns.txt as you see fit. |
@creviera I updated with more text form |
This pull request introduces 1 alert when merging 63f9eeb into 514b9e9 - view on LGTM.com new alerts:
|
this lgtm - linter test fails though:
might want to move the special strings into a txt file? |
Our future test strings are so good that they are breaking Python linting tools 🐍🕺 🐍
|
63f9eeb
to
9a75a52
Compare
This pull request introduces 1 alert when merging 9a75a52 into 309f17e - view on LGTM.com new alerts:
|
securedrop/create-dev-data.py
Outdated
|
||
client_test = int(os.getenv('CLIENT_TEST_DATA', 0)) | ||
for i in range(1, client_test): | ||
create_source_and_submissions(i, client_test, client_test_data=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you're passing client_test
in for source_count
? could you instead pass num_sources
and make CLIENT_TEST_DATA
a boolean that says whether or not special strings should be used?
UPDATE
Let's talk more tomorrow about the design and how we imagine QA will use this feature as well as how we might use this for our screenshot tests. It'll also make it easier for me to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a version with Allie's suggested change above, which works nicely for me (feel free not to use this):
diff --git a/securedrop/create-dev-data.py b/securedrop/create-dev-data.py
index e689c6080..de5b8ea85 100755
--- a/securedrop/create-dev-data.py
+++ b/securedrop/create-dev-data.py
@@ -59,18 +59,17 @@ def main(staging=False):
# Add test sources and submissions
num_sources = int(os.getenv('NUM_SOURCES', 2))
+ client_test = bool(os.getenv('CLIENT_TEST_DATA', 0))
for i in range(1, num_sources + 1):
if i == 1:
# For the first source, the journalist who replied will be deleted
create_source_and_submissions(
- i, num_sources, journalist_who_replied=journalist_tobe_deleted
+ i, num_sources, journalist_who_replied=journalist_tobe_deleted,
+ client_test_data=client_test
)
continue
- create_source_and_submissions(i, num_sources)
+ create_source_and_submissions(i, num_sources, client_test_data=client_test)
- client_test = int(os.getenv('CLIENT_TEST_DATA', 0))
- for i in range(1, client_test):
- create_source_and_submissions(i, client_test, client_test_data=True)
# Now let us delete one journalist
db.session.delete(journalist_tobe_deleted)
db.session.commit()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
further thoughts in here: #5224 (review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After my conversation with Ro about how this feature could be used during QA, I think it would make sense to have a follow-up discussion about a) populating production and staging servers with the same test data that we use here in our development environment so it can be used during QA, and b) what our default configuration of the server should be when testing.
Even though the change in this PR only applies to the dev container, I tried to think about how this would be used by QA in the following feedback:
-
Like messages, we should be able to populate replies with all the different test data
-
The default configuration should be the most broadly useful during test. For me, this means it should be fast so that I can test as I develop (this is less important for QA testers but it doesn't hurt), as well as easily reproducible to faciliate creating STRs when bugs are found.
So far your change meets this criteria but I think we can take it a step further and make it the default, i.e. running
make dev
should use all the test data strings. This would mean that you could get rid ofCLIENT_TEST_DATA
all together and skip converting it into a Boolean. So, by default, you could just populate the client with as many sources as you need in order to show all strings in the test data file, and if NUM_SOURCES is set to more or less than that, you just cycle through the list. It would be convenient to only show one message and one reply by default that each show the same test data string. -
In the future it would be nice to also add to the default configuration special cases, such as:
- a source with no messages or replies
- a source with one message
- a source with one message and file
- a source with one file
- a source with one reply
-
In the future we could add a scalability-testing envrionment variable for configuring sources with many, many messages and replies as well.
9a75a52
to
2fca9dd
Compare
This pull request introduces 1 alert when merging 2fca9dd into 2c65008 - view on LGTM.com new alerts:
|
@kushaldas Tried the changes in 2fca9dd and imo they look good and work well. I'm not going to weigh in on whether A few other points that came out of my conversation with @creviera:
|
Personally I like the behavior as it is now; for new developers using the development environment, it doesn't add a huge performance penalty (creation of sources is pretty zippy; it takes 15 seconds to create 43 sources on my older X1), and for more experienced devs, it's easy enough to add |
The one caveat is that all replies are identical right now. We've sometimes seen issues that arise only in messages, or only in replies, such as the recent styling differences reported in freedomofpress/securedrop-client#1082 (comment), or the context menu bug in freedomofpress/securedrop-client#1064 . I don't think this absolutely needs to be resolved in this PR, but it would be IMO preferable for messages and replies to both use the special strings file. |
Yeah, I agree that we can build on top of this change and that it doesn't need to do all the things. To be clear about what my review comment is requesting for changes:
This is to catch bugs that only occur in the reply bubbles. Reply bubbles descend from the same class as message bubbles but they introduce new GUI behavior, like adding failure messages and changing the color bar, and so can we might miss a styling bug if we only show test data strings in message bubbles. Also, this would allow us to see special strings in preview snippets, which would allow us to catch more bugs. This can be made into a smaller issue that can be done outside of this PR.
As Ro pointed out this would add a lot of time when starting This doesn't need to hold up your PR, but it is confusing as is, because when you run |
I really don't think that's desirable - testers should not have to count up the number of test cases or look for a magic number somewhere. If we don't want to default to importing all, IMO there should be a symbolic way to specify this, e.g., |
Personally, I still prefer:
And in the future... maybe something like:
|
Agreed, if we want to make |
This pull request introduces 1 alert when merging 46a5d87 into beced1f - view on LGTM.com new alerts:
|
I think this needs to be kicked twice due to the test timeout issue. |
(referring to |
Taking a quick look at 46a5d87 ... |
602e438
to
c83d8c4
Compare
This pull request introduces 1 alert when merging c83d8c4 into ebc193c - view on LGTM.com new alerts:
|
LGTM. Test plan:
Recent changes by Allie LGTM. May benefit from a squash before merge. |
This pull request introduces 1 alert when merging d370fb0 into ebc193c - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK to merge once CI passes. Thank you @creviera for your patient review on this one!
One can get all the client source strings by using the `NUM_SOURCES=ALL make dev` command. The `make dev` command will create 2 sources as usual. One can also assign the number of sources (say 10) by `NUM_SOURCES=10 make dev` command. Fixes #1080 Special strings sourced from: https://github.com/freedomofpress/securedrop-client/wiki/Message-Test-Data
d370fb0
to
9d82324
Compare
(Squashed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approving post-squash.
This pull request introduces 1 alert when merging 9d82324 into ebc193c - view on LGTM.com new alerts:
|
Erm, that LGTM alert actually looks legit, looks like we're concatenating strings that should be separate per https://github.com/freedomofpress/securedrop-client/wiki/Message-Test-Data |
@eloquence Nice catch, I agree, we should fix that prior to merge. Thanks, LGTM: https://lgtm.com/projects/g/freedomofpress/securedrop/rev/pr-7c7409194c43f3b116ae35ee0fa18f076d1125dfh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTLGTM, LGTM.
Status
Ready for review
Description of Changes
Fixes freedomofpress/securedrop-client#1080
Adds many different test strings to test
securedrop-client
text formatting.Testing
make dev
should have 2 sourcesNUM_SOURCES=10 make dev
should create 10 sourcesNUM_SOURCES=ALL make dev
shoudl create 43 sourcesDeployment
Any special considerations for deployment? Consider both:
Checklist
If you made changes to the server application code:
make lint
) and tests (make test
) pass in the development containerIf you made changes to
securedrop-admin
:make -C admin test
) pass in the admin development containerIf you made changes to the system configuration:
If you made non-trivial code changes:
If you made changes to documentation:
make docs-lint
) passed locallyIf you added or updated a code dependency:
Choose one of the following: