public void TestLoadCustomPlatform() { var agrix = new Agrix("platform: test", new AgrixSettings("abc", "http://example.org/", TestAssembly)); Assert.Equal(typeof(TestPlatform), agrix.LoadPlatform().GetType()); }
public void TestLoadPlatform() { var agrix = new Agrix( "platform: vultr", BasicSettings); Assert.Equal( typeof(VultrPlatform), agrix.LoadPlatform().GetType()); }
public void TestValidate() { using var requests = new MockVultrRequests( new HttpHandler("/account/info")); var agrix = new Agrix( Resources.SimpleConfig, new AgrixSettings("abc", requests.Url)); agrix.Validate(); }
public void TestValidateServer(string configName) { using var requests = new MockVultrRequests( new HttpHandler("/account/info")); var config = Resources.ResourceManager.GetString(configName); var agrix = new Agrix(config, new AgrixSettings("abc", requests.Url)); agrix.Validate(); }
public void TestDestroy(bool dryrun) { using var requests = new MockVultrRequests( new HttpHandler( "destroy", $"label=myserver&dryrun={dryrun}", "")); var agrix = new Agrix(Resources.TestPlatformConfig, new AgrixSettings("abc", requests.Url, TestAssembly)); agrix.Destroy(dryrun); requests.AssertAllCalledOnce(); }
public void TestProcess(bool dryrun) { var expected = "plan.cpu=2&plan.memory=4096&plan.type=SSD&" + "os.name=Fedora%2032%20x64&os.app=Fedora%2032%20x64&" + $"os.iso=&dryrun={dryrun}"; using var requests = new MockVultrRequests( new HttpHandler("provision", expected, "")); var agrix = new Agrix(Resources.TestPlatformConfig, new AgrixSettings("abc", requests.Url, TestAssembly)); agrix.Process(dryrun); requests.AssertAllCalledOnce(); }
public void TestValidateInvalidServer() { var agrix = new Agrix(Resources.InvalidServerConfig, BasicSettings); Assert.Throws <AgrixValidationException>(() => agrix.Validate()); }
public void TestValidateUnsupportedPlatform() { var agrix = new Agrix("platform:", BasicSettings); Assert.Throws <AgrixValidationException>(() => agrix.Validate()); }
public void TestValidatePlatformIsRequired() { var agrix = new Agrix("servers:", BasicSettings); Assert.Throws <AgrixValidationException>(() => agrix.Validate()); }