Skip to content

Commit

Permalink
Item12102: getRevisionAtATime test
Browse files Browse the repository at this point in the history
was too sensitive to slow systems.  Can't assume that the original rev
was created at a particular time,  need to return the actual time.


Conflicts:

	UnitTestContrib/test/unit/VCStoreTests.pm

git-svn-id: http://svn.foswiki.org/trunk@15448 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Sep 28, 2012
1 parent daa03ad commit ac12e73
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions UnitTestContrib/test/unit/VCStoreTests.pm
Expand Up @@ -133,6 +133,11 @@ sub _createInconsistentTopic {
; # we should have a history now, with topic 1 as the latest rev
$meta->finish();

my $then = (
stat(
"$Foswiki::cfg{DataDir}/$this->{test_web}/$this->{test_topic}.txt")
)[9];

# Wait for the clock to tick
my $x = time;
while ( time == $x ) {
Expand All @@ -153,9 +158,13 @@ CRUD
# The .txt has been mauled, so getLatestRev should return 2

return (
stat(
"$Foswiki::cfg{DataDir}/$this->{test_web}/$this->{test_topic}.txt")
)[9];
(
stat(
"$Foswiki::cfg{DataDir}/$this->{test_web}/$this->{test_topic}.txt"
)
)[9],
$then
);
}

# Get revision info where there is no history (,v file)
Expand Down Expand Up @@ -247,7 +256,7 @@ sub verify_InconsistentTopic_getRevisionInfo {
my $this = shift;

# Inconsistent cache with topicinfo
my $date = $this->_createInconsistentTopic();
my ( $date, $then ) = $this->_createInconsistentTopic();
my ($meta) =
Foswiki::Func::readTopic( $this->{test_web}, $this->{test_topic} );

Expand Down Expand Up @@ -352,7 +361,7 @@ sub verify_NoHistory_implicitSave {
sub verify_Inconsistent_implicitSave {
my $this = shift;

my $date = $this->_createInconsistentTopic();
my ( $date, $then ) = $this->_createInconsistentTopic();

# Head of "history" will be 1, we've got one pending checkin, so latest revision
# is reporting 2, the next revision will be 2.
Expand Down Expand Up @@ -445,7 +454,7 @@ sub verify_NoHistory_repRev {
sub verify_Inconsistent_repRev {
my $this = shift;

my $date = $this->_createInconsistentTopic();
my ( $date, $then ) = $this->_createInconsistentTopic();

my ($meta) =
Foswiki::Func::readTopic( $this->{test_web}, $this->{test_topic} );
Expand Down Expand Up @@ -494,8 +503,7 @@ sub verify_NoHistory_getRevisionAtTime {
sub verify_Inconsistent_getRevisionAtTime {
my $this = shift;

my $then = time;
my $date = $this->_createInconsistentTopic();
my ( $date, $then ) = $this->_createInconsistentTopic();

my ($meta) =
Foswiki::Func::readTopic( $this->{test_web}, $this->{test_topic} );
Expand Down Expand Up @@ -556,7 +564,8 @@ sub verify_NoHistory_saveAttachment {
sub verify_Inconsistent_saveAttachment {
my $this = shift;

my $date = $this->_createInconsistentTopic();
my ( $date, $then ) = $this->_createInconsistentTopic();

$this->assert(
open( my $FILE, ">", "$Foswiki::cfg{TempfileDir}/testfile.txt" ) );
print $FILE "one two three";
Expand Down Expand Up @@ -596,7 +605,7 @@ sub verify_Inconsistent_saveAttachment {
# verify that the value of a FORMFIELD is taken from the text and not the head
sub verify_Inconsistent_Item10993_FORMFIELD_from_text {
my $this = shift;
my $date = $this->_createInconsistentTopic();
my ( $date, $then ) = $this->_createInconsistentTopic();

$this->assert_str_equals(
"Beaver=Beaver",
Expand Down

0 comments on commit ac12e73

Please sign in to comment.