Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Metacello Integration tests and fixing the detected problems #882

Merged
merged 17 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
private actions
addLocalRepository
self repository location: self locationToUse.
self repository pluginManager repositoryWillBeCreated: self repository.
self repository pluginManager repositoryWillBeCreated: self repository.

self repository workingCopy initializePackagesFromRepository.
self doEnsureProject.

self repository pluginManager repositoryWasCreated: self repository.
^ self repository
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ cloneRepository
self commitishName
ifNotNil: [ self repository switchToCommitishNamed: self commitishName ].
self repository pluginManager repositoryWillBeCreated: self repository.

self repository workingCopy initializePackagesFromRepository.
self doEnsureProject.

self repository pluginManager repositoryWasCreated: self repository.
^ self repository
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
private
doEnsureProject

| fileFormat |

ensureProjectFile ifFalse: [ ^ self ].
self repository project isUnbornProject ifFalse: [ ^ self ].

fileFormat := self repository project fileFormat.

self repository workingCopy project:
((IceProject onRepository: self repository)
fileFormat: fileFormat;
sourceDirectory: self subdirectory;
yourself)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
API-project
ensureProjectFile
ensureProjectFile := true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initialize
super initialize.
ensureProjectFile := false
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"remote",
"branchName",
"subdirectory",
"repository"
"repository",
"ensureProjectFile"
],
"name" : "IceRepositoryCreator",
"type" : "normal"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
requirements
empty
^ self new
properties: Dictionary new;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
comparing
= anotherObject

^ self species = anotherObject species and: [ properties = anotherObject properties ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comparing
hash
^ properties hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
isDirty
^ repository workingCopy referenceCommit project ~= self
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repository creation
extractTypeFromDescription: description

(description beginsWith: 'ftp://') ifTrue: [ ^'ftp' ].
IceMetacelloRepositoryType allTypes
detect: [ :each | each isSuitableForLocation: description ]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
testing
commitishConfiguration

^ IceTestParameter
withOptions: self commitishOptions
on: self
selector: #commitishToUse

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
testing
commitishOptions

^ { ''. "Without commitish"
':forBecomeWriteable'. "With branch"
':1.2.3'. "with tag"}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
commitishToUse: aValue

CommitishToUse := aValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
commitishToUse

^ CommitishToUse ifNil: [ '' ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
testing
isAbstract

^ self == IceMetacelloIntegrationTests
^ self name = #IceMetacelloIntegrationTests
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
testing
parameters

^ { self remoteTypeConfiguration }
^ { self remoteTypeConfiguration.
self commitishConfiguration }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
defaultTimeLimit
^ 30 seconds
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
expectedFileFormat

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
hasProject

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
tests
installBaseline

self subclassResponsibility
Metacello new
baseline: 'PharoGitTest';
repository: (self repository , self class commitishToUse);
load.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests
repositoriesForTest

^ IceRepository registry select: [ :e | e name = 'pharo-git-test' ]
^ IceRepository registry select: [ :e | e name = self repositoryName ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
repository

^ 'github://pharo-vcs/' , self repositoryName
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests
repositoryForTest

^ IceRepository registry detect: [ :e | e name = 'pharo-git-test' ]
^ IceRepository registry detect: [ :e | e name = self repositoryName ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
repositoryName

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
shouldBeDirty

^ false
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tearDown

"Remove temporary repository just in case"
'temp/test' asFileReference ensureDeleteAll.
(IceLibgitRepository localRepositoriesLocation/'pharo-vcs/pharo-git-test') ensureDeleteAll.
(IceLibgitRepository localRepositoriesLocation/'pharo-vcs'/self repositoryName) ensureDeleteAll.

super tearDown.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ testInstallBaselineWhenNoSSHIsAvailableUsesHTTPS

"This test is meant to run in the CI using SSH, when SSH is not available.
Other configurations make no sense for this test"
self isTestingSSH ifFalse: [ ^ self skip ].
self isCI ifFalse: [ ^ self skip ].
self isTestingSSH ifTrue: [ ^ self skip ].

self installBaseline.
repository := self repositoryForTest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ testInstallBaselineWhileMissingRepositoryIsInstalledIsPossible
self installBaseline.
repository := self repositoryForTest.

self assert: (repository workingCopy loadedPackages allSatisfy: [ :each | each isClean ])
self assert: repository workingCopy isModified equals: self shouldBeDirty
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ testInstallBaselineWithConflictingUnrelatedRepositoryInDiskThrowsError
(self isTestingSSH and: [ self isCI ])
ifTrue: [ ^ self skip ].

self createConflictingRepositoryIn: IceLibgitRepository localRepositoriesLocation/'pharo-vcs/pharo-git-test'.
self createConflictingRepositoryIn: IceLibgitRepository localRepositoriesLocation/ 'pharo-vcs' / self repositoryName.

self should: [ self installBaseline ] raise: IceMetacelloDuplicatedNotification
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ testNewRepositoryPackagesAreClean
self installBaseline.
repository := self repositoryForTest.

self assert: (repository workingCopy loadedPackages allSatisfy: [ :each | each isClean ])
self assert: repository workingCopy isModified equals: self shouldBeDirty
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
tests
testProjectIsNotDirty
testProjectDirtiness

"Avoid this test if on ssh on the CI"
(self isTestingSSH and: [ self isCI ])
ifTrue: [ ^ self skip ].

self installBaseline.
repository := self repositoryForTest.
self deny: repository isModified

self assert: repository isModified equals: self shouldBeDirty
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tests
testProjectFileFormat

"Avoid this test if on ssh on the CI"
(self isTestingSSH and: [ self isCI ])
ifTrue: [ ^ self skip ].

self installBaseline.
repository := self repositoryForTest.

self assert: repository project fileFormat equals: self expectedFileFormat.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tests
testProjectHasDescriptor

"Avoid this test if on ssh on the CI"
(self isTestingSSH and: [ self isCI ])
ifTrue: [ ^ self skip ].

self installBaseline.
repository := self repositoryForTest.

self assert: repository project isUnbornProject equals: self hasProject not.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"category" : "Iceberg-Tests-MetacelloIntegration",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"classvars" : [
"CommitishToUse"
],
"instvars" : [
"repository",
"conflictingRepository"
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testing
commitishOptions

^ super commitishOptions , { ':61024d7e81eac0b752ade9f3e03f6e2bd34ee5bf' "With commit"}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
configuring
expectedFileFormat
^ IceLibgitFiletreeWriter
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
hasProject

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
repositoryName

^ 'pharo-git-test-withProject-and-noSource'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
shouldBeDirty

^ false
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "IceMetacelloIntegrationWithTagTests",
"name" : "IceMetacelloIntegrationWithProjectAndNoSrcDir",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
testing
commitishOptions

^ super commitishOptions , {
':30c9f38109f437d184b4017e7d9da9d953266e8b'. "With commit"
"Adding the src directory"
'/src'. "Without commitish"
':forBecomeWriteable/src'. "With branch"
':1.2.3/src'. "with tag"
':30c9f38109f437d184b4017e7d9da9d953266e8b/src'. "With commit" }



Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
configuring
expectedFileFormat
^ IceLibgitFiletreeWriter
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
hasProject

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
repositoryName

^ 'pharo-git-test-withProject-and-source'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuring
shouldBeDirty

^ false
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "IceMetacelloIntegrationWithDefaultHEADTests",
"name" : "IceMetacelloIntegrationWithProjectAndSrcDir",
"type" : "normal"
}
Loading