Skip to content

Add morrisjobke/webdav docker container for external storage tests - #16688

Merged
PVince81 merged 4 commits into
masterfrom
tests-dockerapachewebdav
May 31, 2016
Merged

PVince81 merged 4 commits into
masterfrom
tests-dockerapachewebdav

Conversation

@PVince81

@PVince81 PVince81 commented Jun 2, 2015

Copy link
Copy Markdown
Contributor

Fixes #15897

Note: not all tests pass yet. This is only about introducing the instance.

These are my results:

% ./autotest-external.sh sqlite webdav-apache
(...)
Configuration read from /srv/www/htdocs/owncloud/tests/phpunit-autotest-external.xml

............................................F............F..F.... 65 / 71 ( 91%)
......

Time: 1.23 seconds, Memory: 16.50Mb

There were 3 failures:

1) Test\Files\Storage\DAV::testStat
Failed asserting that 100 matches expected 1433252136.

/srv/www/htdocs/owncloud/tests/lib/files/storage/storage.php:303

2) Test\Files\Storage\DAV::testRenameOverWriteDirectory
rename must return true on success
Failed asserting that false is true.

/srv/www/htdocs/owncloud/tests/lib/files/storage/storage.php:462

3) Test\Files\Storage\DAV::testCopyOverWriteDirectory
Failed asserting that true is false.

/srv/www/htdocs/owncloud/tests/lib/files/storage/storage.php:518

FAILURES!
Tests: 71, Assertions: 324, Failures: 3.
stop: stop-webdav-apache.sh
Docker executable found - stop and remove docker containers
Stopping and removing docker container 7c0544b7235e4f976457d27d8f4ce3f31c0d1ba3bf47c3ad380d7f25abe5af3d
7c0544b7235e4f976457d27d8f4ce3f31c0d1ba3bf47c3ad380d7f25abe5af3d
skip: start-webdav-ownCloud.sh

Please review @MorrisJobke @DeepDiver1975 @Xenopathic

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Any solution at hand to get rid of the failing tests? We can only set this up on jenkins once we are green - otherwise this will no detect regressions.

Just saying ....

@PVince81

PVince81 commented Jun 2, 2015

Copy link
Copy Markdown
Contributor Author

I'll see what I can do

@PVince81 PVince81 self-assigned this Jun 2, 2015
@MorrisJobke

Copy link
Copy Markdown
Contributor

@PVince81 Are you sure the WebDAV server works as intended? Maybe it's also a problem with the docker setup. 🙈

@PVince81

PVince81 commented Jun 2, 2015

Copy link
Copy Markdown
Contributor Author

Well some of the fails are about overwriting, maybe Apache's Webdav server doesn't let people overwrite with a MOVE operation like other servers does.

But from your past comments I had the feeling that the docker instance did not work AT ALL (100% fail) but here it seems to work fine for most cases.

@PVince81

PVince81 commented Jun 2, 2015

Copy link
Copy Markdown
Contributor Author

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

Something seems odd with this DAV server:

dav:/webdav/> mkdir base
Creating `base': succeeded.
dav:/webdav/> mkdir sub
Creating `sub': succeeded.
dav:/webdav/> mv base sub
Moving `/webdav/base' to `/webdav/sub/base':  redirect to http://localhost:8888/webdav/base/
dav:/webdav/> ls
Listing collection `/webdav/': succeeded.
Coll:   base                                   0  Jul  3 18:58
Coll:   sub                                    0  Jul  3 18:58
dav:/webdav/> 

It doesn't properly move.

If you compare with an ownCloud server:

dav:/owncloud/remote.php/webdav/> mkdir base
Creating `base': succeeded.
dav:/owncloud/remote.php/webdav/> mkdir sub
Creating `sub': succeeded.
dav:/owncloud/remote.php/webdav/> mv base sub
Moving `/owncloud/remote.php/webdav/base' to `/owncloud/remote.php/webdav/sub/base':  succeeded.
dav:/owncloud/remote.php/webdav/> ls
Listing collection `/owncloud/remote.php/webdav/': succeeded.
Coll:   sub                                    0  Jul  3 19:00
dav:/owncloud/remote.php/webdav/> ls sub
Listing collection `/owncloud/remote.php/webdav/sub/': succeeded.
Coll:   base                                   0  Jul  3 18:59

Maybe Apache with mod_dav behaves differently or needs config tweaks.

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

Yep, it must be the server.
I tried KDE's Dolphin and I also cannot move "base" into "sub" there, getting an error.

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

I think I found the problem: when doing a Webdav MOVE operation, a "Destination" header must be specified with the full URL to the destination, not relative.

Since we are outside the docker instance, the URL is the one of the docker instance, not the one inside. However the Webdav server would only understand it if it was its own internal URL.

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

Also happening on my VirtualBox VM when connecting to the Webdav server from outside it.
Maybe there is a way to set at alias, maybe some kind of reverse proxy config ?

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

Strangely renaming files work, maybe Apache is clever enough to find out that it's the same file.

But moving folders doesn't (neither in cadaver not ownCloud).
I tried making the "Destination" field relative but then I get BadRequest. From what I read online it's only allowed in future versions of the Webdav spec...

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

Okay, it seems that:

  • cadaver's MOVE operation doesn't work properly with mod_dav servers with URL differences
  • doing a straight curl works: curl -X MOVE -u test:test "http://test-ubuntuserver2.local:8080/webdav/c/" -H 'Destination: http://test-ubuntuserver2.local:8080/webdav/b/c'. This explains why all the "move" tests worked
  • looks like move + overwrite works too with curl, the condition being that the target path as a trailing slash when it's a directory. Let's try that with our code.

@PVince81
PVince81 force-pushed the tests-dockerapachewebdav branch from 95b5eb9 to 1177969 Compare July 3, 2015 17:50
@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

Solved the move/copy + overwrite issue by adding a trailing slash, see 1177969

Still, there is the testStat that still fails.

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author
Configuration read from /srv/www/htdocs/owncloud/tests/phpunit-autotest-external.xml

............................................F.................... 65 / 71 ( 91%)
......

Time: 1.19 seconds, Memory: 16.50Mb

There was 1 failure:

1) Test\Files\Storage\DAV::testStat
Failed asserting that 100 matches expected 1435945545.

/srv/www/htdocs/owncloud/tests/lib/files/storage/storage.php:303

FAILURES!
Tests: 71, Assertions: 329, Failures: 1.

@PVince81

PVince81 commented Sep 1, 2015

Copy link
Copy Markdown
Contributor Author

Still have trouble with the stat tests

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Still have trouble with the stat tests

lets move this to 9.0

@DeepDiver1975 DeepDiver1975 modified the milestones: 9.0-next, 8.2-current Sep 22, 2015
@PVince81

Copy link
Copy Markdown
Contributor Author

Looks like either the target DAV server doesn't support "touch" (PROPPATCH with getlastmodified) or we're doing the touch wrong

@PVince81

Copy link
Copy Markdown
Contributor Author

Usually a proppatch should return a list of updated properties. So we should check whether the "lastmodified" property was actually set, and if not return false.

@PVince81

Copy link
Copy Markdown
Contributor Author

Indeed, in general Webdav servers do not let you modify "lastmodified": http://stackoverflow.com/a/17979769
ownCloud is the exception.

@PVince81

Copy link
Copy Markdown
Contributor Author

Looks like Sabre doesn't return the PROPPATCH response, so we cannot find out whether the server accepted the property. Raised here https://github.com/fruux/sabre-dav/issues/726

@PVince81

Copy link
Copy Markdown
Contributor Author

The next step here is: wait for 8.1.4 to be released because it contains the PROPPATCH fix #19738 which will then appear in the owncloud docker instance. This should at least make the "touch()" operation work properly in that case.

@PVince81
PVince81 force-pushed the tests-dockerapachewebdav branch from 1177969 to ff52bd6 Compare November 16, 2015 16:32
@PVince81

Copy link
Copy Markdown
Contributor Author

@PVince81

Copy link
Copy Markdown
Contributor Author

It was suggested here that ownCloud could advertise supporting PROPP #22499 (comment)

If we do this, it would be possible to check that DAV header before attempting a touch. If the server does not advertise that it supports it, then we fallback to the other logic when touch is not supported.

@PVince81

Copy link
Copy Markdown
Contributor Author

=> discussed with @MorrisJobke and we'll have a look at doing this: after a touch, do a PROPFIND on the target to make sure the mtime was properly accepted. This is needed to find out whether to use the touch fallback.

@PVince81
PVince81 force-pushed the tests-dockerapachewebdav branch from ff52bd6 to a76e1e4 Compare April 1, 2016 19:20
@PVince81

PVince81 commented Apr 1, 2016

Copy link
Copy Markdown
Contributor Author

Done, I added another PROPFIND after PROPPATCH to check if touch succeeded: a76e1e4

Please review @MorrisJobke @icewind1991 @nickvergessen @blizzz


return array(
'run'=>true,
'host'=>'localhost:$port/webdav/',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail on Jenkins. Please use the IP address of the container like in

host=`docker inspect --format="{{.NetworkSettings.IPAddress}}" $container`

@MorrisJobke

Copy link
Copy Markdown
Contributor

Beside my above comment this works really nice 👍

#
# Set environment variable DEBUG to print config file
#
# @author Morris Jobke

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that I've written this alone ;)

@PVince81
PVince81 force-pushed the tests-dockerapachewebdav branch from a76e1e4 to 0a2712f Compare May 3, 2016 10:20
@PVince81

PVince81 commented May 3, 2016

Copy link
Copy Markdown
Contributor Author

Rebased and adjusted env scripts to work on CI

@PVince81

Copy link
Copy Markdown
Contributor Author

Ah, stupid thing, it hung on the last test. Almost won 😦

Rebasing...

@PVince81
PVince81 force-pushed the tests-dockerapachewebdav branch from 0a2712f to 46d2531 Compare May 13, 2016 08:15
@PVince81

Copy link
Copy Markdown
Contributor Author

Can you guys review this ? @MorrisJobke @DeepDiver1975 @Xenopathic @icewind1991

Note that it also comes with some fixes for non-ownCloud webdav

@MorrisJobke

MorrisJobke commented May 13, 2016 •

Copy link
Copy Markdown
Contributor

Looks good 👍

@PVince81

Copy link
Copy Markdown
Contributor Author

Second review please @icewind1991 @Xenopathic @DeepDiver1975 @rullzer

Vincent Petry added 4 commits May 30, 2016 16:10
The trailing slash is needed when talking to Apache's mod_dav server
ownCloud as remote DAV always accepts the mtime on touch, but other
servers like Apache's DAV server doesn't. The latter doesn't give any
visible hint in its response to detect this case, so this fix does a
subsequent PROPFIND to check whether the mtime was actually set.

Since a touch() operation seldom happens (only on uploads), the minor
performance loss should hopefully be acceptable.
@PVince81
PVince81 force-pushed the tests-dockerapachewebdav branch from 46d2531 to d201ffe Compare May 30, 2016 14:11
@rullzer

rullzer commented May 30, 2016

Copy link
Copy Markdown
Contributor

👍

@PVince81

Copy link
Copy Markdown
Contributor Author

We're past feature freeze, however this only adds tests + a bugfix for DAV, so this is acceptable.

Merging.

@PVince81
PVince81 merged commit 3361cdf into master May 31, 2016
@PVince81
PVince81 deleted the tests-dockerapachewebdav branch May 31, 2016 07:55
@lock

lock Bot commented Aug 5, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebDAV docker instance for autotest-external

5 participants