Search in sources :

Example 16 with BeforeGroups

use of org.testng.annotations.BeforeGroups in project rhsm-qe by RedHatQE.

the class OstreeTests method setupGiWrapperTool.

// TODO might want to implement a teardownOstreeRepoConfigFile @AfterGroups
@BeforeGroups(groups = { "setup" }, value = { "subscribeAndUnsubscribeTests" })
protected void setupGiWrapperTool() {
    if (clienttasks == null)
        return;
    // determine the path to giWrapperFilename (because it changed by commit 655b81b5271cba98143b36aaa33938b0abaf1820 )
    // provided by subscription-manager-plugin-ostree
    String giWrapperFilename = "gi_wrapper.py";
    giWrapperFile = new File(client.runCommandAndWait("rpm -ql subscription-manager-plugin-ostree | grep -e " + giWrapperFilename + "$").getStdout().trim());
    // UPDATE: As of RFE Bug 1378495, subscription-manager will no longer touch the ostree origin file after attaching a subscription that provides content of type "ostree"
    if (clienttasks.isPackageVersion("subscription-manager-plugin-ostree", ">=", "1.18.5-1")) {
        // commit 689a7a8d8c0ee2f59781273e49fa6d9942bea5e9 1378495: Do not touch OSTree Origin files.	// Bug 1378495 - [RFE] Do not change OStree origin refspec
        log.warning("Due to RFE Bug 1378495, this version of subscription-manager-plugin-ostree will no longer make any modifications to the ostree origin file.");
        Assert.assertTrue(giWrapperFile.getName().isEmpty(), "Asserting that subscription-manager-plugin-ostree no longer provides the '" + giWrapperFilename + "' tool formerly used to find the path to the true ostreeOriginFile.");
        // was used to find the path to the true ostreeOriginFile
        giWrapperFile = null;
        return;
    }
    // assert that the giWrapperFilename (provided by subscription-manager-plugin-ostree) was determined
    Assert.assertTrue(!giWrapperFile.getPath().isEmpty(), "Determined full path to source code filename '" + giWrapperFilename + "' (determined value '" + giWrapperFile.getPath() + "')");
    if (!clienttasks.isPackageInstalled("ostree")) {
        // backup gi_wrapper.py
        if (!RemoteFileTasks.testExists(client, giWrapperFile + ".bak")) {
            client.runCommandAndWait("cp -n " + giWrapperFile + " " + giWrapperFile + ".bak");
        }
        // create a fake gi_wrapper.py tool that simply prints the path to an ostree origin file
        client.runCommandAndWait("echo -e '#!/usr/bin/python\n# Print the path to the current deployed FAKE OSTree origin file.\nprint \"" + ostreeOriginFile + "\"' > " + giWrapperFile);
    }
    // get the real location of the ostreeOriginFile and save it
    // -bash-4.2# python /usr/share/rhsm/subscription_manager/plugin/ostree/gi_wrapper.py --deployed-origin
    // /ostree/deploy/rhel-atomic-host/deploy/7ea291ddcec9e2451616f77808386794a62befb274642e07e932bc4f817dd6a1.0.origin
    SSHCommandResult gi_wrapperResult = client.runCommandAndWait("python " + giWrapperFile + " --deployed-origin");
    Assert.assertEquals(gi_wrapperResult.getExitCode(), new Integer(0), "Exit Code from running gi_wrapper.py");
    Assert.assertEquals(gi_wrapperResult.getStderr(), "", "Stderr from running gi_wrapper.py");
    Assert.assertTrue(!gi_wrapperResult.getStdout().trim().isEmpty(), "Stdout from running gi_wrapper.py is not empty");
    // Path to the current deployed OSTree origin file.
    ostreeOriginFile = new File(gi_wrapperResult.getStdout().trim());
}
Also used : BigInteger(java.math.BigInteger) SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) File(java.io.File) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 17 with BeforeGroups

use of org.testng.annotations.BeforeGroups in project rhsm-qe by RedHatQE.

the class TranslationTests method beforeTestYumSearchDoesNotThrowAsciiCodecError.

@BeforeGroups(groups = "setup", value = { "VerifyYumSearchDoesNotThrowAsciiCodecError_Test" })
public void beforeTestYumSearchDoesNotThrowAsciiCodecError() {
    if (clienttasks == null)
        return;
    // register with auto-subscribe
    SSHCommandResult result = clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, true, null, null, (String) null, null, null, null, true, false, null, null, null, null);
    // this will cause VerifyYumSearchDoesNotThrowAsciiCodecError_Test to skip because isRhelProductCertSubscribedForVerifyYumSearchDoesNotThrowAsciiCodecError is false
    if (result.getStdout().contains("No products installed."))
        return;
    isRhelProductCertSubscribedForVerifyYumSearchDoesNotThrowAsciiCodecError = clienttasks.isRhelProductCertSubscribed();
    // remove python-simplejson
    String pkg = "python-simplejson";
    if (clienttasks.isPackageInstalled(pkg))
        clienttasks.yumRemovePackage(pkg);
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 18 with BeforeGroups

use of org.testng.annotations.BeforeGroups in project atsd-api-test by axibase.

the class LimitTest method prepareValueOrderData.

@BeforeGroups(groups = { VALUE_ORDER_TEST_GROUP })
public void prepareValueOrderData() throws Exception {
    long date = Util.getUnixTime("2016-06-19T11:00:00.000Z");
    Series series = new Series(entity(), VALUE_ORDER_METRIC);
    float[] values = { 1.23f, 3.12f, 5.67f, 4.13f, 5, -4, 4, 8, 6, 5 };
    for (int i = 1; i < 10; i++) {
        Sample sample = Sample.ofDateDecimal(Util.ISOFormat(date + i * TimeUnit.HOURS.toMillis(1)), new BigDecimal(values[i]));
        series.addSamples(sample);
    }
    SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Sample(com.axibase.tsd.api.model.series.Sample) BigDecimal(java.math.BigDecimal) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 19 with BeforeGroups

use of org.testng.annotations.BeforeGroups in project atsd-api-test by axibase.

the class LimitTest method prepareTagsTimeOrderData.

@BeforeGroups(groups = { TAGS_ORDER_TEST_GROUP })
public void prepareTagsTimeOrderData() throws Exception {
    List<Series> seriesList = new ArrayList<>();
    String entityName = entity();
    long startTime = Util.getUnixTime("2016-06-19T11:00:00.000Z");
    int[] values = { 6, 7, 0, -1, 5, 15, 88, 3, 11, 2 };
    for (int i = 0; i < 3; i++) {
        Series series = new Series(entityName, TAGS_ORDER_METRIC);
        series.addSamples(Sample.ofDateInteger(Util.ISOFormat(startTime + i * TimeUnit.HOURS.toMillis(1)), values[i]));
        seriesList.add(series);
    }
    SeriesMethod.insertSeriesCheck(seriesList);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) ArrayList(java.util.ArrayList) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 20 with BeforeGroups

use of org.testng.annotations.BeforeGroups in project atsd-api-test by axibase.

the class LimitTest method prepareDateTimeOrderData.

@BeforeGroups(groups = { DATETIME_ORDER_TEST_GROUP })
public void prepareDateTimeOrderData() throws Exception {
    Series series = new Series(entity(), DATETIME_ORDER_METRIC);
    series.addSamples(Sample.ofDateInteger("2016-06-19T11:00:00.000Z", 1), Sample.ofDateInteger("2016-06-19T11:03:00.000Z", 2), Sample.ofDateInteger("2016-06-19T11:02:00.000Z", 3), Sample.ofDateInteger("2016-06-19T11:01:00.000Z", 5), Sample.ofDateInteger("2016-06-19T11:04:00.000Z", 4));
    SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) BeforeGroups(org.testng.annotations.BeforeGroups)

Aggregations

BeforeGroups (org.testng.annotations.BeforeGroups)21 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)11 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)7 SkipException (org.testng.SkipException)7 Series (com.axibase.tsd.api.model.series.Series)4 File (java.io.File)4 ArrayList (java.util.ArrayList)4 Sample (com.axibase.tsd.api.model.series.Sample)2 Date (java.util.Date)2 JSONObject (org.json.JSONObject)2 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 Connection (java.sql.Connection)1 HashMap (java.util.HashMap)1 JSONArray (org.json.JSONArray)1 AfterGroups (org.testng.annotations.AfterGroups)1