Created
September 28, 2018 12:38
-
-
Save madelaney/f1e478cb20fd6d003a1e159bef337989 to your computer and use it in GitHub Desktop.
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
def call() { | |
// Runtime.runtime.availableProcessors() | |
def value = sh(returnStdout: true, script: 'nproc') | |
value = value.trim() | |
return value.toInteger() | |
} |
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
def execute() { | |
node('master') { | |
stage ('Checkout') { | |
checkout scm | |
} | |
stage ('Cores') { | |
cores() | |
} | |
} | |
} | |
return this |
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
import static com.lesfurets.jenkins.unit.MethodSignature.method | |
import com.lesfurets.jenkins.unit.BasePipelineTest | |
import org.junit.Test | |
import org.junit.Before | |
class TestMachineThreading extends BasePipelineTest { | |
@Override | |
@Before | |
void setUp() throws Exception { | |
super.setUp() | |
} | |
@Test | |
void available_cores_returned() throws Exception { | |
try { | |
def script = loadScript('src/test/resources/MachineThreading.jenkins') | |
script.execute() | |
printCallStack() | |
} | |
catch (MalformedURLException ex) { | |
// Do nothing. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment