Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Tests are essential to make this module truly reliable. Let's make this happen.
Comments
Comment #1
Wim LeersInitial tests committed. They use
DrupalUnitTestCase
, for far greater testing speed. I've hacked my way around the fact that it doesn't supportvariable_*()
by default — we need that for the tests, since the CDN module makes many decisions based on these.These tests cover:
- detection of HTTP/HTTPS requests
- parsing of CDN mapping + deciding which mapping to use based on the protocol of the current request (HTTP or HTTPS)
As such, they will help with implementing #1452092: Automatically distribute certain filetypes over multiple CDNs without causing regressions.
Commit: http://drupalcode.org/project/cdn.git/commit/b3d6165.
Comment #2
Wim LeersRolled a patch for #1452092: Automatically distribute certain filetypes over multiple CDNs, includes updated unit tests: #1452092-8: Automatically distribute certain filetypes over multiple CDNs.
Comment #3
andreiashu CreditAttribution: andreiashu commentedWoa!!! +10 :)
I'll take a look over this soon.
Thanks!
Comment #4
Wim LeersThe first test failed: http://qa.drupal.org/pifr/test/235088. Because Drupal's testing system sucks so badly that it's not really running in isolation on my system… hurray!
Follow-up commit that fixed this: http://drupalcode.org/project/cdn.git/commit/a4ab5ea. Fingers crossed!
Comment #5
Wim LeersIt did fix it, hurray :) See http://drupal.org/project/cdn/testing-status or http://qa.drupal.org/pifr/test/235088. It's a start!
Comment #6
Wim LeersTests were extended in #1452092: Automatically distribute certain filetypes over multiple CDNs.
Comment #7
Wim LeersNew test added at #1515392: UFI mapping not correctly applied (fix + unit tests).
Comment #8
Wim LeersThe most critical components are now unit tested. As bugs are uncovered and features are added, they're tightened further: #1593930: cdn_get_domains() is broken for auto-balancing when using protocol-relative domains: fix + tighten tests.
Note that we do *not* have integration tests, feature tests, etc., just unit tests. This is probably going to be sufficient, at least for now.
EDIT: or rather, it's not necessarily sufficient, but it gives us the biggest return on investment :) (i.e. the most bug-sensitive parts are unit tested.)