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.

git-svn-id: http://svn.foswiki.org/branches/Release01x01@15447 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Sep 28, 2012
1 parent fc7645d commit 01fa753
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions UnitTestContrib/test/unit/VCStoreTests.pm
Expand Up @@ -121,6 +121,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 @@ -141,9 +146,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 @@ -340,7 +349,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 2, and should contain $TEXT2
my ($meta) =
Expand Down Expand Up @@ -422,7 +431,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 @@ -468,8 +477,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 @@ -530,7 +538,7 @@ 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" ) );
Expand Down Expand Up @@ -567,7 +575,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 01fa753

Please sign in to comment.