Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

About testLocalDiscoveryToggle and testPrinterOffSendGoodbyePacket #21

Closed
YYWeave opened this issue Mar 31, 2016 · 7 comments
Closed

About testLocalDiscoveryToggle and testPrinterOffSendGoodbyePacket #21

YYWeave opened this issue Mar 31, 2016 · 7 comments
Assignees

Comments

@YYWeave
Copy link

YYWeave commented Mar 31, 2016

・testLocalDiscoveryToggle

We have manually checked our printer respects GCP Mgt page when local discovery toggled.
But this test result is "failed" and here is the error message:
 File "C:...\cloudprint_logocert-master\testcert.py", line 1841, in testLocalDiscoveryToggle
 self.assertFalse(mdns_browser.listener.discovered[k])
AssertionError:
{'info': ServiceInfo(
 type='_privet._tcp.local.',
 name=u'XXXXXXXXXX._privet._tcp.local.',
 address='\xc0\xa8\xd53',
 port=80, weight=0, priority=0,
 server=u'YYYYYYYY.local.',
 properties=
 {
 'ty': 'XXXXXXXXXX',
 'url': 'https://www.google.com/cloudprint',
 'note': 'XXXXXXXXXX',
 'cs': 'online',
 'txtvers': '1',
 'type': 'printer',
 'id': '82f0ce26-ab86-215f-64af-4293ad10d473'
 }
 ),
 'found': False,
 'proto': '_privet._tcp.local.'
} is not false
※XXXXXXXXXX and YYYYYYYYYY are the names of our printer.

・testPrinterOffSendGoodbyePacket

Using the tool called wireshark we have checked that our printer sent goodbye packet when powered off.
But the result is almost same as Q2. Just the line where error occurred is different.
 File "C:...\cloudprint_logocert-master\testcert.py", line 1929, in testPrinterOffSendGoodbyePacket
self.assertFalse(mdns_browser.listener.discovered[k])
AssertionError: …(the next message is same as testLocalDiscoveryToggle)

When we use the old tool downloaded around Sep. of last year,
The results of testLocalDiscoveryToggle and testPrinterOffSendGoodbyePacket are “Passed”.
But using the latest tool with the same printer firmware, both are “Failed”.
Could you give us some advises to fix these issues?

@kdlucas
Copy link
Contributor

kdlucas commented Mar 31, 2016

For testLocalDiscoveryToggle, the assumption is that the listener will not discover any mdns announcements once Local Discovery is turned off. I see there was a change from using self.browser to mdns_browser a couple of months ago. I wonder if that could have affected this test.

Could you do me a favor and compare the source code of the old and new LogoCert Tool and see if there are any differences that look like they might have affected these two tests?

@YYWeave
Copy link
Author

YYWeave commented Apr 1, 2016

I have compared the source code of the old and new LogoCert Tool.
Here is the difference of the _mdns.py file which might be the reason why these two issues occurs.

Old Tool

def add_service(self, zeroconf, type, name):
self.logger.info("Service added: '%s' (type is %s)", name, type)
self.discovered[name] = True

New Tool

def add_service(self, zeroconf, service_type, name):
self.logger.info('Service added: "%s" (type is %s)', name, service_type)
self.discovered[name] = {}
self.discovered[name]['proto'] = service_type
self.discovered[name]['found'] = True

I think there is something wrong with the testcert.py of the new tool in line 1841 and line 1929(code is same as line 1841).
So I tried to modify the source as below.
before: self.assertFalse(mdns_browser.listener.discovered[k])
after : self.assertFalse(mdns_browser.listener.discovered[k]['found'])
It should be also necessary to remove the code of line 1818 where compile error would be happened here. I commented it.
With the two modifications, fortunately the two test results changed to "Passed".
Please confirm if my modifications are right.

There is a new issue I want to confirm which occurs just because the order of the tests in my opinion.
When I run testLocalDiscoveryToggle and testPrinterOffSendGoodbyePacket separately, there is no problem. But after running testPrinterIdleNoBroadcastPrivet, both of testLocalDiscoveryToggle and testPrinterOffSendGoodbyePacket will be failed.
It seems like the execution of testPrinterIdleNoBroadcastPrivet would affect the following test.

@kdlucas
Copy link
Contributor

kdlucas commented Apr 4, 2016

Yes, looks like your logic might be correct. I'll take a look at the source
code this week and get a change submitted.

Kelly
kdLucas

On Fri, Apr 1, 2016 at 3:30 AM, YYWeave notifications@github.com wrote:

I have compared the source code of the old and new LogoCert Tool.
Here is the difference of the _mdns.py file which might be the reason why
these two issues occurs.
Old Tool

def add_service(self, zeroconf, type, name):
self.logger.info("Service added: '%s' (type is %s)", name, type)
self.discovered[name] = True
New Tool

def add_service(self, zeroconf, service_type, name):
self.logger.info('Service added: "%s" (type is %s)', name, service_type)
self.discovered[name] = {}
self.discovered[name]['proto'] = service_type
self.discovered[name]['found'] = True

I think there is something wrong with the testcert.py of the new tool in
line 1841 and line 1929(code is same as line 1841).
So I tried to modify the source as below.
before: self.assertFalse(mdns_browser.listener.discovered[k])
after : self.assertFalse(mdns_browser.listener.discovered[k]['found'])
It should be also necessary to remove the code of line 1818 where compile
error would be happened here. I commented it.
With the two modifications, fortunately the two test results changed to
"Passed".
Please confirm if my modifications are right.

There is a new issue I want to confirm which occurs just because the order
of the tests in my opinion.
When I run testLocalDiscoveryToggle and testPrinterOffSendGoodbyePacket
separately, there is no problem. But after running
testPrinterIdleNoBroadcastPrivet, both of testLocalDiscoveryToggle and
testPrinterOffSendGoodbyePacket will be failed.
It seems like the execution of testPrinterIdleNoBroadcastPrivet would
affect the following test.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#21 (comment)

@kdlucas
Copy link
Contributor

kdlucas commented May 1, 2016

I made some changes, see if this fixes the issues.

I don't think the testPrinterIdleNoBroadcastPrivet should affect any tests,
as it's just listening to see if any Privet packets were advertised over a
given period of time.

Kelly
kdLucas

On Fri, Apr 1, 2016 at 3:30 AM, YYWeave notifications@github.com wrote:

I have compared the source code of the old and new LogoCert Tool.
Here is the difference of the _mdns.py file which might be the reason why
these two issues occurs.
Old Tool

def add_service(self, zeroconf, type, name):
self.logger.info("Service added: '%s' (type is %s)", name, type)
self.discovered[name] = True
New Tool

def add_service(self, zeroconf, service_type, name):
self.logger.info('Service added: "%s" (type is %s)', name, service_type)
self.discovered[name] = {}
self.discovered[name]['proto'] = service_type
self.discovered[name]['found'] = True

I think there is something wrong with the testcert.py of the new tool in
line 1841 and line 1929(code is same as line 1841).
So I tried to modify the source as below.
before: self.assertFalse(mdns_browser.listener.discovered[k])
after : self.assertFalse(mdns_browser.listener.discovered[k]['found'])
It should be also necessary to remove the code of line 1818 where compile
error would be happened here. I commented it.
With the two modifications, fortunately the two test results changed to
"Passed".
Please confirm if my modifications are right.

There is a new issue I want to confirm which occurs just because the order
of the tests in my opinion.
When I run testLocalDiscoveryToggle and testPrinterOffSendGoodbyePacket
separately, there is no problem. But after running
testPrinterIdleNoBroadcastPrivet, both of testLocalDiscoveryToggle and
testPrinterOffSendGoodbyePacket will be failed.
It seems like the execution of testPrinterIdleNoBroadcastPrivet would
affect the following test.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#21 (comment)

@kdlucas
Copy link
Contributor

kdlucas commented May 18, 2016

Please verify if the changes fixed this.

@YYWeave
Copy link
Author

YYWeave commented May 19, 2016

Only the issue of testLocalDiscoveryToggle was fixed.
I think the change in line1841 of testcert.py should be also modified in line1865, line1900 and line1929 as the same reason. I tried it and testPrinterOffSendGoodbyePacket was fixed.
Please confirm if I am right.

@kdlucas
Copy link
Contributor

kdlucas commented May 19, 2016

Ok, I've committed the changes, please verify the fix.

@kdlucas kdlucas self-assigned this Jun 22, 2016
@kdlucas kdlucas closed this as completed Jun 22, 2016
kool814 pushed a commit to kool814/cloudprint_logocert that referenced this issue Jul 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants