Skip to content

Instantly share code, notes, and snippets.

@madelaney
Created September 28, 2018 12:38
Show Gist options
  • Save madelaney/f1e478cb20fd6d003a1e159bef337989 to your computer and use it in GitHub Desktop.
Save madelaney/f1e478cb20fd6d003a1e159bef337989 to your computer and use it in GitHub Desktop.
def call() {
// Runtime.runtime.availableProcessors()
def value = sh(returnStdout: true, script: 'nproc')
value = value.trim()
return value.toInteger()
}
def execute() {
node('master') {
stage ('Checkout') {
checkout scm
}
stage ('Cores') {
cores()
}
}
}
return this
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