Part of lp.archivepublisher.tests.test_repositoryindexfile View In Hierarchy
Method | setUp | Create temporary directories to be used in tests. |
Method | tearDown | Purge temporary files created on setUp . |
Method | getRepoFile | Return a RepositoryIndexFile for the given filename. |
Method | testWorkflow | RepositoryIndexFile workflow. |
Method | testWrite | RepositoryIndexFile writing. |
Method | testCompressors | RepositoryIndexFile honours the supplied list of compressors. |
Method | testUnreferencing | RepositoryIndexFile unreferencing. |
Method | testRootCreation | RepositoryIndexFile creates given 'root' path if necessary. |
Method | testMissingTempRoot | RepositoryIndexFile cannot be given a missing 'temp_root'. |
Method | testRemoveOld | RepositoryIndexFile removes old index files. |
'root': final destination for repository files. 'temp_root': temporary destination for reporsitory files.
RepositoryIndexFile
for the given filename.
The RepositoryIndexFile
is created with the test 'root' and
'temp_root'.
RepositoryIndexFile
workflow.
On creation, 2 temporary files are atomically created in the 'temp_root' location (mkstemp). One for storing the plain contents and other for the corresponding compressed contents. At this point, no files were created in the 'root' location yet.
Once the RepositoryIndexFile
is closed, the files in 'temp_root'
are closed and moved to 'root' with their expected names.
Additionally, the resulting files are made readable and writable by their group and readable by others.
RepositoryIndexFile
writing.
Writes to a RepositoryIndexFile
happens simultaneously in both
of its counter-parts (plain and gzipped contents). Once the file
is closed both resulting files have the same contents, one plain and
other compressed.
RepositoryIndexFile
unreferencing.
When a RepositoryIndexFile
is unreferenced it takes care of
removing the created files in the 'temp_root'.