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 RFC3454 data, to support offline testing #137

Merged
merged 1 commit into from
Mar 13, 2023
Merged

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Mar 10, 2023

We generate rfcs/rfc3454-stringprep_tables.json from RFC3454, and generate the regexps in both lib/net/imap/stringprep/tables.rb and lib/net/imap/stringprep/saslprep_tables.rb using those tables extracted from RFC3454. The JSON data is also used to validate that the regexps are still valid, as we use Unicode character classes which can be updated every year, and thus with every new version of ruby.

However, this means that the test suite cannot be run offline (unless you have previously downloaded RFC3454). Adding the text version of RFC3454 solves this issue.

Fixes #136.

We generate `rfcs/rfc3454-stringprep_tables.json` from RFC3454, and
generate the regexps in both `lib/net/imap/stringprep/tables.rb` and
`lib/net/imap/stringprep/saslprep_tables.rb` using those tables
extracted from RFC3454.  The JSON data is also used to validate that the
regexps are still valid, as we use Unicode character classes which can
be updated every year, and thus with every new version of ruby.

However, this means that the test suite cannot be run offline (unless
you have previously downloaded RFC3454).  Adding the text version of
RFC3454 solves this issue.

Fixes #136.
@nevans
Copy link
Collaborator Author

nevans commented Mar 10, 2023

@hsbt FYI: Because this is only needed to allow self-contained offline testing and isn't ever used at run-time, I'm excluding the rfcs dir from the gemspec files.

@Apteryks
Copy link

Apteryks commented Mar 12, 2023

Hello!

$ ./pre-inst-env guix build ruby-net-imap --with-branch=ruby-net-imap=offline-test-suite

[...]
starting phase `check'
Loaded suite /gnu/store/j4z07lyi1ykk8bc68h1p4bpj1il9dn3f-ruby-2.7.4/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_test_loader
Started
...............................................................................
...............................................................................
..........................
Finished in 14.324993697 seconds.
-------------------------------------------------------------------------------
184 tests, 362 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-------------------------------------------------------------------------------
12.84 tests/s, 25.27 assertions/s
phase `check' succeeded after 16.6 seconds
[...]

LGTM!

Thanks for the timely fix!

Copy link
Member

@hsbt hsbt left a comment

Choose a reason for hiding this comment

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

It's okay to me technically. But I'm not sure what's a license of distribution RFC text.

@nevans Can you do clearly this?

@nevans
Copy link
Collaborator Author

nevans commented Mar 13, 2023

It's okay to me technically. But I'm not sure what's a license of distribution RFC text.

@hsbt: I was wondering that as well. The copyright statement on RFC3454 seems to allow it: "provided that the above copyright notice and this paragraph are included on all such copies and derivative works". Since the entire RFC txt file has been included, unmodified, the copyright notice is included as well:

net-imap/rfcs/rfc3454.txt

Lines 5047 to 5073 in 51e08fb

Full Copyright Statement
Copyright (C) The Internet Society (2002). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

(Alternatively, we could add the rfcs/rfc3454-stringprep_tables.json file and update the rake test dependencies so it doesn't attempt to regenerate itself. But adding the RFC seems like the simplest approach to me.)

@nevans nevans merged commit b212789 into master Mar 13, 2023
@nevans nevans deleted the offline-test-suite branch March 13, 2023 15:34
nevans added a commit that referenced this pull request Jun 12, 2023
**Full Changelog**: v0.3.4...v0.3.5

* 📚 Fix #response documentation error, by @nevans in 87ba74e
* ✅ Add RFC3454 data, to support offline testing, by @nevans in #137
* Adds Ruby 3.2 to the CI matrix, by @petergoldstein in #99
* Use reusing workflow, by @hsbt in #151
* Decode UTF-7 more strictly, by @nobu in #152
* ⬇️ Continue testing 0.3.x branch against ruby 2.6, by @nevans in 115d190
* ✅ Fix decode utf-7 test for ruby 2.6, by @nevans in 7a60c8f
* 🐛 Fix XOAUTH2 authenticator for ruby 2.6, by @nevans in bd4faa0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

test suite cannot be run offline
3 participants