Hi Filip,
could you perhaps run the attached file on the test machine (with
`py.test vdir_test.py`, py.test is needed for the creation of a temp
directory).

On my machine the output looks like this:
[(0, 10), (0.0001, 8), (0.001, 0), (0.01, 0), (0.1, 0), (1, 0)]

Similar experiments before made me choose the current delay.

Best regards,
Christian

Quoting Filip Pytloun (2016-11-24 00:20:50)
> On 2016/11/24 00:00, Santiago Vila wrote:
> > Try using a chroot without union-type=overlay.
> 
> Unfortunately it will result in the same error :-/
import os
import time


def get_etag_from_file(f):
    '''Get mtime-based etag from a filepath or file-like object.

    This function will flush/sync the file as much as necessary to obtain a
    correct mtime.
    '''
    stat = os.stat(f)
    mtime = getattr(stat, 'st_mtime_ns', None)
    if mtime is None:
        mtime = stat.st_mtime
    return '{:.9f}'.format(mtime)


def test_etag(tmpdir):
    fpath = os.path.join(str(tmpdir), 'foo')
    stats = dict()
    for delay in [0, 0.0001, 0.001, 0.01, 0.1, 1]:
        failed = list()
        for one in range(10):

            file_ = open(fpath, 'w')
            file_.write('foo')
            file_.close()

            old_etag = get_etag_from_file(fpath)
            time.sleep(delay)

            file_ = open(fpath, 'w')
            file_.write('bar')
            file_.close()

            new_etag = get_etag_from_file(fpath)

            if old_etag == new_etag:
                failed.append(
                    (one, new_etag)
                )
            stats[delay] = len(failed)
    print(sorted(stats.items()))
    assert False  # here to make sure we get the print output via py.test

Reply via email to