Fuse system tests in contrib/fuse/runtests.py are broken #888

Closed
opened 2010-01-09 11:39:01 +00:00 by francois · 11 comments
francois commented 2010-01-09 11:39:01 +00:00
Owner

Zooko advised me to run the Fuse tests to see if they pass after #811 was fixed. This is unfortunately not the case because a of a couple problems.

  1. runtests.py is being too picky about warning printed on stdout, this is addressed by #876.

  2. tahoe nodes are not correctly configured because runtests.py uses the old configuration method, e.g. it creates a webport file instead of editing tahoe.cfg. This is addressed by this ticket.

Zooko advised me to run the Fuse tests to see if they pass after #811 was fixed. This is unfortunately not the case because a of a couple problems. 1. *runtests.py* is being too picky about warning printed on stdout, this is addressed by #876. 2. tahoe nodes are not correctly configured because runtests.py uses the old configuration method, e.g. it creates a *webport* file instead of editing *tahoe.cfg*. This is addressed by this ticket.
tahoe-lafs added the
unknown
major
defect
1.5.0
labels 2010-01-09 11:39:01 +00:00
tahoe-lafs added this to the 1.6.0 milestone 2010-01-09 11:39:01 +00:00
francois commented 2010-01-09 12:43:51 +00:00
Author
Owner

Attachment fix-bug-888.dpatch (36673 bytes) added

**Attachment** fix-bug-888.dpatch (36673 bytes) added
francois commented 2010-01-09 13:02:03 +00:00
Author
Owner

With this patch applied on top of the patches from #881 and #876, I can finally run 'make fuse-test' from the tahoe codebase.

$ make fuse-test 2> /dev/null| fgrep "Test Results"
*** Test Results implementation impl_c_no_split: 2 failed out of 12.
*** Test Results implementation impl_a: 5 failed out of 5.
*** Test Results implementation impl_c: 2 failed out of 12.
*** Test Results implementation impl_b: 5 failed out of 5.

There's something weird with the 'impl_c' test because running 'make fuse-test' multiple times doesn't always lead to same number of failed tests. This number varies between 1 and 3. Other tickets will be opened to deal with that as soon as I figure out what makes those tests break.

Anyway, this patch is ready for review.

With this patch applied on top of the patches from #881 and #876, I can finally run 'make fuse-test' from the tahoe codebase. ``` $ make fuse-test 2> /dev/null| fgrep "Test Results" *** Test Results implementation impl_c_no_split: 2 failed out of 12. *** Test Results implementation impl_a: 5 failed out of 5. *** Test Results implementation impl_c: 2 failed out of 12. *** Test Results implementation impl_b: 5 failed out of 5. ``` There's something weird with the 'impl_c' test because running 'make fuse-test' multiple times doesn't always lead to same number of failed tests. This number varies between 1 and 3. Other tickets will be opened to deal with that as soon as I figure out what makes those tests break. Anyway, this patch is ready for review.
davidsarah commented 2010-01-15 01:41:31 +00:00
Author
Owner

content = re.sub('%s = (.+)' % key, '%s = %s' % (key, value), content)

What if %s = (.+) matches a partial line?

`content = re.sub('%s = (.+)' % key, '%s = %s' % (key, value), content)` What if `%s = (.+)` matches a partial line?
davidsarah commented 2010-01-15 02:24:50 +00:00
Author
Owner

Replying to davidsarah:

content = re.sub('%s = (.+)' % key, '%s = %s' % (key, value), content)

What if %s = (.+) matches a partial line?

The docs for re.sub seem to say that it can. Brian on IRC suggested that the test should probably be creating a new tahoe.cfg rather than editing an existing one (the only fields needed seem to be web.port and introducer.furl.

Replying to [davidsarah](/tahoe-lafs/trac-2024-07-25/issues/888#issuecomment-74428): > `content = re.sub('%s = (.+)' % key, '%s = %s' % (key, value), content)` > > What if `%s = (.+)` matches a partial line? The [docs for re.sub](http://docs.python.org/library/re.html#re.sub) seem to say that it can. Brian on IRC suggested that the test should probably be creating a new `tahoe.cfg` rather than editing an existing one (the only fields needed seem to be `web.port` and `introducer.furl`.
francois commented 2010-01-19 09:16:20 +00:00
Author
Owner

Replying to [davidsarah]comment:4:

What if %s = (.+) matches a partial line?
The docs for re.sub seem to say that it can.

According to the documentation, the '+' qualifier is greedy by default. I don't see how a partial line could be matched.

Brian on IRC suggested that the test should probably be creating a new tahoe.cfg rather than editing an existing one (the only fields needed seem to be web.port and introducer.furl.

Won't it break more easily in the future if new mandatory configuration directives were to be added by tahoe create-client?

Replying to [davidsarah]comment:4: > > What if `%s = (.+)` matches a partial line? > The [docs for re.sub](http://docs.python.org/library/re.html#re.sub) seem to say that it can. According to the [documentation](http://docs.python.org/library/re.html#regular-expression-syntax), the `'+'` qualifier is greedy by default. I don't see how a partial line could be matched. > Brian on IRC suggested that the test should probably be creating a new `tahoe.cfg` rather than editing an existing one (the only fields needed seem to be `web.port` and `introducer.furl`. Won't it break more easily in the future if new mandatory configuration directives were to be added by `tahoe create-client`?

I don't care either way -- if the test code breaks due to a new configuration directive then we can fix it at that time, but on the other hand the current use of ((.+) is correct and we could accept it. (Besides which "this is just test code" -- if the (.+) matches on a partial line then the worst that would happen is that the tests would spuriously fail and we would notice and fix it.)

David-Sarah: have you reviewed the rest of the patch? Any other issues with it?

I don't care either way -- if the test code breaks due to a new configuration directive then we can fix it at that time, but on the other hand the current use of `((.+)` is correct and we could accept it. (Besides which "this is just test code" -- if the `(.+)` matches on a partial line then the worst that would happen is that the tests would spuriously fail and we would notice and fix it.) David-Sarah: have you reviewed the rest of the patch? Any other issues with it?
davidsarah commented 2010-01-20 00:41:31 +00:00
Author
Owner

Replying to [francois]comment:5:

Replying to [davidsarah]comment:4:

What if %s = (.+) matches a partial line?
The docs for re.sub seem to say that it can.

According to the documentation, the '+' qualifier is greedy by default. I don't see how a partial line could be matched.

It can match starting part-way through a line. To be correct it should be ^%s = (.+)$ with the MULTILINE flag specified. (The $ isn't necessary except for clarity, because . doesn't match a newline. The ^ is necessary, though.)

However, I suggest using the option-based approach described below instead.

Brian on IRC suggested that the test should probably be creating a new tahoe.cfg rather than editing an existing one (the only fields needed seem to be web.port and introducer.furl.

Won't it break more easily in the future if new mandatory configuration directives were to be added by tahoe create-client?

It would be better still to use the --webport= and --introducer= options when creating the node. I.e. something like

  if clientnum == 0:
      # The first client is special:
      self.clientbase = base
      self.port = random.randrange(1024, 2**15)
      webport = 'tcp:%d:interface=127.0.0.1\n' % (self.port,)
      self.weburl = "http://127.0.0.1:%d/" % (self.port,)
      print self.weburl
  else:
      webport = 'none'

  introfurl_path = os.path.join(introbase, 'introducer.furl')
  furl = open(introfurl_path).read().strip()

  output = self.run_tahoe('create-client',
                          '--basedir', base,
                          '--webport=%s' % (webport,),
                          '--introducer=%s' % (furl,))
Replying to [francois]comment:5: > Replying to [davidsarah]comment:4: > > > > What if `%s = (.+)` matches a partial line? > > The [docs for re.sub](http://docs.python.org/library/re.html#re.sub) seem to say that it can. > > According to the [documentation](http://docs.python.org/library/re.html#regular-expression-syntax), the `'+'` qualifier is greedy by default. I don't see how a partial line could be matched. It can match starting part-way through a line. To be correct it should be `^%s = (.+)$` with the MULTILINE flag specified. (The `$` isn't necessary except for clarity, because `.` doesn't match a newline. The `^` is necessary, though.) However, I suggest using the option-based approach described below instead. > > Brian on IRC suggested that the test should probably be creating a new `tahoe.cfg` rather than editing an existing one (the only fields needed seem to be `web.port` and `introducer.furl`. > > Won't it break more easily in the future if new mandatory configuration directives were to be added by `tahoe create-client`? It would be better still to use the `--webport=` and `--introducer=` options when creating the node. I.e. something like ``` if clientnum == 0: # The first client is special: self.clientbase = base self.port = random.randrange(1024, 2**15) webport = 'tcp:%d:interface=127.0.0.1\n' % (self.port,) self.weburl = "http://127.0.0.1:%d/" % (self.port,) print self.weburl else: webport = 'none' introfurl_path = os.path.join(introbase, 'introducer.furl') furl = open(introfurl_path).read().strip() output = self.run_tahoe('create-client', '--basedir', base, '--webport=%s' % (webport,), '--introducer=%s' % (furl,)) ```
davidsarah commented 2010-01-20 21:57:23 +00:00
Author
Owner

There are also a few pyflakes warnings for runtests.py, that might as well be fixed while we're changing it:

contrib\fuse\runtests.py:144: local variable 'target' is assigned to but never used
contrib\fuse\runtests.py:161: local variable 'se' is assigned to but never used
contrib\fuse\runtests.py:759: local variable 'e' is assigned to but never used

(line numbers might be slightly off).

There are also a few pyflakes warnings for runtests.py, that might as well be fixed while we're changing it: ``` contrib\fuse\runtests.py:144: local variable 'target' is assigned to but never used contrib\fuse\runtests.py:161: local variable 'se' is assigned to but never used contrib\fuse\runtests.py:759: local variable 'e' is assigned to but never used ``` (line numbers might be slightly off).
francois commented 2010-01-24 21:30:09 +00:00
Author
Owner

David-Sarah: Thanks for your advise! I'm not sure I'll be able to rewrite this patch before 1.6 though. Anyway, the next tine I'll touch this test script, I'll use that.

David-Sarah: Thanks for your advise! I'm not sure I'll be able to rewrite this patch before 1.6 though. Anyway, the next tine I'll touch this test script, I'll use that.

David-Sarah has suggested some good improvements, and François intends to implement them next time he touches this code. For most Tahoe-LAFS code we would tend to leave the patch out of trunk until the better version is implemented, but this is for source:contrib and I'm going to apply this patch, because fuse tests are broken in Tahoe-LAFS v1.5 so this can't possibly cause a regression.

David-Sarah has suggested some good improvements, and François intends to implement them next time he touches this code. For most Tahoe-LAFS code we would tend to leave the patch out of trunk until the better version is implemented, but this is for source:contrib and I'm going to apply this patch, because fuse tests are broken in Tahoe-LAFS v1.5 so this can't possibly cause a regression.

fixed by changeset:d0c6aa569d965b3d but a better version of this patch would be nice. Thanks, François and David-Sarah!

fixed by changeset:d0c6aa569d965b3d but a better version of this patch would be nice. Thanks, François and David-Sarah!
zooko added the
fixed
label 2010-01-26 01:50:24 +00:00
zooko closed this issue 2010-01-26 01:50:24 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#888
No description provided.