For #265973: XML-RPC chokes with long server response I created a test. Is seems that that bug is memory dependent.

This patch adds a service messageSizedInK and creates a 80K and a 160K message. Both messages pass my test. Is this test solid enough?

I think simpletest must run test with memory settings dependant.

Comments

clemens.tolboom’s picture

StatusFileSize
new2.89 KB

Hmmm ... this messageSizedInK should not be in validator1 service. And the test is wrong implemented.

The new patch has it's own service name message and it's own test class.

Messages up to around 160K are successful.

kika’s picture

xmlrpc_test_message_sized_in_kb($size) sounds better

boombatower’s picture

Component: simpletest.module » tests
boombatower’s picture

Status: Active » Needs review
StatusFileSize
new3.04 KB

Few format issues and clearness changes (#2 included) (minor changes):

  • messageSizedInKB -> messageSizedInKB
  • xmlrpc_test_message_sized_in_k -> xmlrpc_test_message_sized_in_kb
  • Removed extra white-space (you can use regex [ ]+$ or your editor if it has it.)
  • Comments start with capital and end with period.
  • Other formatting issues.

Test passes:
3 passes, 0 fails, 0 exceptions

boombatower’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.32 KB

Test looks good I think it is ready to go. A few more formatting fixes and added comments.

I think it ready to go.

dries’s picture

Status: Reviewed & tested by the community » Needs work

The patch still has coding style issues (i.e. incorrect spacing after commas). I'd also write XML-RPC in PHPdoc, rather than xmlrpc.

clemens.tolboom’s picture

Status: Needs work » Active
StatusFileSize
new3.13 KB

- Changed some doc. (XML-RPC, size in KB)
- Did not find that space :-(
- Removed useless doc line (// Make sure xmlrpc_message is included by calling xmlrpc first.)
- Changed the calling order for getting remote and local message.

boombatower’s picture

Status: Active » Needs review
boombatower’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.13 KB

Fixed a period and one extra space.

I think it looks fine. (thine eyes != perfect)

webchick’s picture

Status: Reviewed & tested by the community » Needs work
+ * @param $size Message size in KB.
+ * @return array Generated message structure.
...
+   * @param $message_size Size of message in KB.

Needs to be consistent with other PHPDoc, which is to put the param on one line, the description on the next.

+  for($i = 0 ; $i < 128; $i++) {

needs a space between for and (

+    // Almost 1KB block.

Sorry? I don't parse this comment.

+  function sizedMessage($message_size) {

The point of this function isn't clear from its name; would help if there was a verb there. But it's weird to have a layer of indirection between the testX function and the assertions. I get that you're trying to avoid duplication of code, but what if we did something like this intead:

function testSizedMessages() {
  $sizes = array(8, 80, 160);
  foreach ($sizes as $size) {
    // Test the size here.
  }
}
clemens.tolboom’s picture

Status: Needs work » Needs review
StatusFileSize
new2.95 KB

Great suggestion for that function removal.

Bummer I wasted your time for the other typos.

Hope everything is now in order.

boombatower’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.98 KB

Removed some extra line spacing and added a period to comment.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Awesome, thank you!

I just made one little tweak which was to move...

+      $xml_url = url(NULL, array('absolute' => TRUE)) . 'xmlrpc.php';

...outside of the foreach loop, since it's not dependent on $size.

Committed. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.