示例#1
0
        }
    }
}
if (!USERNAME || !APIKEY || !AUTHURL) {
    die('No environment values set');
}
/**
 * START THE TESTS!
 */
printf("SmokeTest started at %s\n", date(TIMEFORMAT, $start));
printf("Using endpoint [%s]\n", $_ENV['NOVA_URL']);
printf("Using region [%s]\n", MYREGION);
step('Authenticate');
$secret = array('username' => USERNAME, 'apiKey' => APIKEY);
$rackspace = new \OpenCloud\Rackspace(AUTHURL, $secret);
$rackspace->AppendUserAgent('(PHP SDK SMOKETEST)');
/**
 * load cached credentials
 */
$fp = @fopen(CACHEFILE, 'r');
if (!$fp) {
    // no cached credentials
    info('Saving credentials in %s', CACHEFILE);
    $rackspace->Authenticate();
    $cred = $rackspace->ExportCredentials();
    $fp = @fopen(CACHEFILE, 'w');
    if (!$fp) {
        die(sprintf("Cannot open cache file %s for writing\n", CACHEFILE));
    }
    fwrite($fp, serialize($cred));
    fclose($fp);