Skip to content

Commit

Permalink
Merge pull request #1849 from tinchodias/21167-Epicea-create-test-dir…
Browse files Browse the repository at this point in the history
…ectory-in-temp

Use /tmp (or analog in other OSs) instead of the working "directory"
  • Loading branch information
estebanlm committed Oct 2, 2018
2 parents a787b88 + 2b8d95d commit 5faf5ce
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/Epicea-Tests/EpTestLogBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ EpTestLogBuilder >> logInitial [
{ #category : #initialization }
EpTestLogBuilder >> newDirectory [

^ ('epicea-tests-', UUID new asString36) asFileReference
^ FileReference newTempFilePrefix: 'epicea-tests-' suffix: ''
]

{ #category : #initialization }
Expand Down
47 changes: 19 additions & 28 deletions src/EpiceaBrowsers-Tests/EpOmbuExporterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,42 @@ Class {
'outputLog',
'inputLog1',
'inputLog2',
'outputDirectory',
'logBuilder1',
'logBuilder2'
],
#category : #'EpiceaBrowsers-Tests-Exporter'
}

{ #category : #accessing }
EpOmbuExporterTest >> outputLogNameForTest [

^ self className, 'LogForTest'
]

{ #category : #running }
EpOmbuExporterTest >> setUp [
EpOmbuExporterTest >> setUp [

super setUp.

logBuilder1 := EpTestLogBuilder new.
logBuilder2 := EpTestLogBuilder new.
logBuilder2 := EpTestLogBuilder new.

"Create 2 logs in different directories"
inputLog1 := logBuilder1 oneTriggerWithFourChildrenLog.
inputLog2 := logBuilder2 oneTriggerWithOneChildLog.
outputLog := EpLog newWithStore: OmFileStore new.

outputDirectory := logBuilder2 directory.
outputLog := EpLog
newWithStore: (OmFileStore named: 'exported' inDirectory: outputDirectory)
]

{ #category : #running }
EpOmbuExporterTest >> tearDown [

logBuilder1 cleanUp.
logBuilder2 cleanUp.

(FileSystem workingDirectory / (self outputLogNameForTest, '.ombu')) ensureDelete.

super tearDown.
]

{ #category : #tests }
EpOmbuExporterTest >> testBasicExport [

| selection outputResult |

selection := inputLog1 entries.

EpOmbuExporter new
Expand Down Expand Up @@ -91,22 +88,16 @@ EpOmbuExporterTest >> testCommentExportWithDependencyFix [
{ #category : #tests }
EpOmbuExporterTest >> testRoundtrip [

| aLog anotherLog |
aLog :=
EpLog newWithStore:
(OmFileStore
named: self outputLogNameForTest
inDirectory: FileSystem workingDirectory).

| outputLogReopened |
EpOmbuExporter new
outputLog: aLog;
outputLog: outputLog;
fileOut: inputLog1 entries.

anotherLog :=
EpLog newWithStore:
(OmFileStore
named: self outputLogNameForTest
inDirectory: FileSystem workingDirectory).
"Open a fresh log with the exported entries.
(fresh, to be sure it was correctly written to disk)"
outputLogReopened := EpLog newWithStore: outputLog store flush copyReopened refresh.

self assert: anotherLog entries size equals: inputLog1 entries size.
self
assert: outputLogReopened entries size
equals: inputLog1 entries size
]
6 changes: 0 additions & 6 deletions src/Ombu-Tests/OmFileStoreTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ Class {
#category : #'Ombu-Tests'
}

{ #category : #resources }
OmFileStoreTest >> directoryForTests [

^ FileSystem workingDirectory
]

{ #category : #resources }
OmFileStoreTest >> setUpOtherStore [

Expand Down
3 changes: 2 additions & 1 deletion src/Ombu-Tests/OmSessionStoreNameStrategyTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ OmSessionStoreNameStrategyTest >> createFileWith: aName [
{ #category : #private }
OmSessionStoreNameStrategyTest >> directory [

^ 'ombu-strategy-tests' asFileReference
^ FileLocator temp asFileReference / 'ombu-strategy-tests'
]

{ #category : #private }
Expand All @@ -41,6 +41,7 @@ OmSessionStoreNameStrategyTest >> fileReferenceWith: aName [

{ #category : #running }
OmSessionStoreNameStrategyTest >> setUp [

super setUp.
strategy := self strategyClass new
]
Expand Down
6 changes: 0 additions & 6 deletions src/Ombu-Tests/OmSessionStoreTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ Class {
#category : #'Ombu-Tests'
}

{ #category : #resources }
OmSessionStoreTest >> directoryForTests [

^ FileSystem workingDirectory
]

{ #category : #resources }
OmSessionStoreTest >> setUpOtherStore [

Expand Down
6 changes: 6 additions & 0 deletions src/Ombu-Tests/OmStoreTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ OmStoreTest >> beforeAndAfterFlushStore: aBlock [
aBlock value.
]

{ #category : #resources }
OmStoreTest >> directoryForTests [

^ FileLocator temp asFileReference / 'ombu-tests'
]

{ #category : #running }
OmStoreTest >> setUp [
super setUp.
Expand Down

0 comments on commit 5faf5ce

Please sign in to comment.