-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Clean up AssetManagerTest by removing redundant tests and c…
…onsolidating configurations - Removed several test cases that were redundant or overly complex, focusing on essential scenarios for AssetManager's behavior. - Consolidated Git configuration tests into static final strings for better readability and maintainability. - Streamlined the setup process for tests, ensuring clarity in the initialization of AssetManager instances. - Enhanced the clarity of the remaining tests by improving comments and structure, making it easier to understand the purpose of each test case.
- Loading branch information
1 parent
662efc5
commit 79dec92
Showing
1 changed file
with
6 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
package nextflow.scm | ||
|
||
import spock.lang.IgnoreIf | ||
|
||
import nextflow.cli.CmdRun | ||
import nextflow.exception.AbortOperationException | ||
import org.eclipse.jgit.api.Git | ||
|
@@ -40,24 +39,16 @@ import java.nio.file.Paths | |
@IgnoreIf({System.getenv('NXF_SMOKE')}) | ||
class AssetManagerTest extends Specification { | ||
|
||
// Test configuration for basic Git repository | ||
def "Test configuration for basic Git repository"() { | ||
expect: 'Git config should be properly formatted' | ||
GIT_CONFIG_TEXT == ''' | ||
static final String GIT_CONFIG_TEXT = ''' | ||
[remote "origin"] | ||
url = https://github.com/nextflow-io/nextflow.git | ||
fetch = +refs/heads/*:refs/remotes/origin/* | ||
[branch "master"] | ||
remote = origin | ||
merge = refs/heads/master | ||
''' | ||
.stripIndent() | ||
} | ||
'''.stripIndent() | ||
|
||
// Test configuration for Git repository with submodules | ||
def "Test configuration for Git repository with submodules"() { | ||
expect: 'Git config with submodules should be properly formatted' | ||
GIT_CONFIG_LONG == ''' | ||
static final String GIT_CONFIG_LONG = ''' | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
|
@@ -72,33 +63,25 @@ class AssetManagerTest extends Specification { | |
merge = refs/heads/master | ||
[submodule "tests"] | ||
url = [email protected]:nextflow-io/tests.git | ||
''' | ||
.stripIndent() | ||
} | ||
'''.stripIndent() | ||
|
||
@Rule | ||
TemporaryPath tempDir = new TemporaryPath() | ||
|
||
def setup() { | ||
given: 'Initialize AssetManager root directory' | ||
AssetManager.root = tempDir.root.toFile() | ||
} | ||
|
||
// Helper method to grab the default branch if set in ~/.gitconfig | ||
String getLocalDefaultBranch() { | ||
given: 'Default branch configuration' | ||
private String getLocalDefaultBranch() { | ||
def defaultBranch = 'master' | ||
def gitconfig = Paths.get(System.getProperty('user.home'),'.gitconfig') | ||
|
||
when: 'Git config exists' | ||
if(gitconfig.exists()) { | ||
def config = new Config() | ||
config.fromText(gitconfig.text) | ||
defaultBranch = config.getString('init', null, 'defaultBranch') ?: 'master' | ||
} | ||
|
||
then: 'Return the default branch' | ||
return defaultBranch | ||
defaultBranch | ||
} | ||
|
||
def "should list available pipeline assets"() { | ||
|