Paws The VIII (The Henry Factor)

Ok today I am going to look a the impact my changes from the last few post have had on the systems as a whole. So far I have tinkered with a few things

  1. Got my RestoreObject to work
  2. Modified the Botocore S3 json file to add in some documentation
  3. I added code to get the 'resopnse' status back by modifying both the code generation templates and the Paws/lib code
  4. Expanded on the test suite
  5. I fiddled with the S3 json file to see if I can get correct error to come up. I did roll this back as Paws does not use these
  6. Created a new test and then modified the paws lib code to get what I think is the correct response back from Paws when there is an error returned by the server
  7. Started to work on the tests I broke with my changes

So today I am going to see what I else I have broken since I have started.

So I did a complete rebuild of paws (still keeping my version of bobocore) and then ran the full test suite and did fairly well


as expected test case 10_responses.t failed a few times

Dubious, test returned 8 (wstat 2048, 0x800) Failed 8/10388 subtests

however test case 't/14_dns_client_errors.t' seem to hang after this test;

not ok 4 - Correct code ConnectionError code

# Failed test 'Correct code ConnectionError code'
# at t/14_dns_client_errors.t line 49.
# got: 'InvalidContent'
# expected: 'ConnectionError'
# Mojo caller
Mojo::Reactor::EV: I/O watcher failed:
syntax error at line 1, column 49, byte 49 at /home/scolesj/aws-sdk-perl/local/lib/perl5/x86_64-linux-thread-multi/XML/Parser.pm line 187.
XML::Simple called at /home/scolesj/aws-sdk-perl/lib/Paws/Net/XMLResponse.pm line 30.

so I better fix that one before I go any further. My changes were simple enough


 like($@->message, qr/(?:Name or service not known|Bad hostname|Could not connect to)/, 'Correct message') if ($match_message_tests);
-cmp_ok($@->code, 'eq', 'ConnectionError', 'Correct code ConnectionError code');
+cmp_ok($@->code, 'eq', 'InvalidContent', 'Correct code ConnectionError code');
+cmp_ok($@->http_status, 'eq', '301',"HTTP status of 301",);

and it passes

ll tests successful.
Files=1, Tests=5, 9 wallclock secs ( 0.02 usr 0.01 sys + 0.57 cusr 0.08 csys = 0.68 CPU)
Result: PASS

But I decided something did not look right and I reran that test on a clean version of paws and got

ok 1 - got exception not ok 2 - Correct code ConnectionError code

# Failed test 'Correct code ConnectionError code'
# at t/14_dns_client_errors.t line 29.
# got: 'InvalidContent'
# expected: 'ConnectionError'
# LWP caller

hmm that is odd. So I did some digging on the subject and on cpantesters this test passes

t/14_dns_client_errors.t ................ ok

So I am not sure if it something I have done or not. So with the fix above I ran the suite again;

Test Summary Report ------------------- t/10_responses.t (Wstat: 2048 Tests: 10388 Failed: 8) Failed tests: 10015-10016, 10019-10020, 10025-10026, 10060-10061 TODO passed: 6364, 6370, 7896, 10045, 10052, 10144 Non-zero exit status: 8 t/11_client_exceptions.t (Wstat: 512 Tests: 27 Failed: 4) Failed tests: 23-24, 26-27 Non-zero exit status: 2 Parse errors: No plan found in TAP output t/18_mocked.t (Wstat: 0 Tests: 4007 Failed: 0) TODO passed: 91-143, 145-154, 156-173, 175-222, 224-262 264-322, 324-330

ok not too bad.

The fixes fof t/10_response.t where in 's3-copy-object.2.response.test.yml','create-bucket.1.response.test.yml' and s3-get-object.2.response.test.yml files and I had to do was fix of the expected results and add in the test for 'http_status'
the next case 't/11_client_exceptions.t' was a little harder to debug as I had to play around a bit to get it to work. To use prove I have to modify my 'PERL5LIB' env value with the path to 'File::Slurper' which was not installed on local perl.
The first 3 where the same sort as before I just updated the expected results and adding the a test for http_status


-  cmp_ok($@->message, 'eq', 'Forbidden', 'S3 exception');
-  cmp_ok($@->code, 'eq', '403', 'Correct code');
+  cmp_ok($@->message, 'eq', 'The AWS Access Key Id you provided does not exist in our records.', 'S3 exception');
+  cmp_ok($@->code, 'eq', 'InvalidAccessKeyId', 'Correct code');
+  cmp_ok($@->http_status, 'eq', '403', 'Correct Status');

the last one

ok 27 - got exception # Failed test 'got exception' # at t/11_client_exceptions.t line 104. # expecting: Paws::Exception # found: Moose::Exception::ValidationFailedForTypeConstraint (Attribute (host_id) does not pass the type constraint because: Validation failed for 'Str' with value undef at /wwwveh/lib/x86_64-linux-thread-multi/Moose/Meta/Class.pm line 275 # Moose::Meta::Class::new_object at (eval 429) line 28 # Throwable::Error::new at /home/scolesj/aws-sdk-perl/lib/Paws/Net/RestXMLResponse.pm line 60 # Paws::Net::RestXMLResponse::error_to_exception at /home/scolesj/aws-sdk-perl/lib/Paws/Net/RestXMLResponse.pm line 25 # Paws::Net::RestXMLResponse::process at /home/scolesj/aws-sdk-perl/lib/Paws/Net/FurlCaller.pm line 48 # Paws::Net::FurlCaller::caller_to_response at /home/scolesj/aws-sdk-perl/lib/Paws/Net/MockCaller.pm line 116 # Paws::Net::MockCaller::caller_to_response at /home/scolesj/aws-sdk-perl/lib/Paws/Net/RetryCallerRole.pm line 19 # Paws::Net::RetryCallerRole::do_call at /home/scolesj/aws-sdk-perl/auto-lib/Paws/Route53.pm line 236 # Paws::Route53::ListHostedZones at t/11_client_exceptions.t line 103 # Test::Exception::throws_ok at t/11_client_exceptions.t line 104 # ) not ok 28 - Route53 exception # Failed test 'Route53 exception' # at t/11_client_exceptions.t line 106. # got: 'Attribute (host_id) does not pass the type constraint because: Validation failed for 'Str' with value undef' # expected: 'Forbidden' Can't locate object method "code" via package "Moose::Exception::ValidationFailedForTypeConstraint" at t/11_client_exceptions.t line 107. # Tests were run but no plan was declared and done_testing() was not seen. # Looks like your test exited with 255 just after 28.
is a little different and I think that is a good place to start on my next post


9504664-6677487-image-a-19_1549531346500.jpg

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations