Groovy web console

subscribe to the feed Subscribe
to this
site
test-jenkins-parse (via #groovywebconsole)
tweet this snippet Tweet
this
script

test-jenkins-parse

Published 3 months ago by mbrt
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
public static void setTag(String a, String b) {
    println(a + ": " + b)
}

tests_results = ["openstack-1-node": "OK", "openstack-3-node": "OK", "azure-extension": "Failed", "functional-kube": "OK", "functional-cm-scale": "Failed"]

// end of dummy stuff


def pascalCase(s) {
    return s.split("-").collect { it.capitalize() }.join()
}

if(true) { // for indentation :)

    for(def test in tests_results) {
        def test_name = test.key
        def test_result = test.value
        // ignore non-functional tests
        if(!test_name.startsWith("functional-")) {
            continue
        }
        def tag = pascalCase(test_name.substring(test_name.indexOf('-') + 1))
        setTag(tag, test_result)
    }

}