public DeviceProvisioningFixture() { Option <Registry> bootstrapRegistry = Option.Maybe(Context.Current.Registries.First()); this.daemon = OsPlatform.Current.CreateEdgeDaemon(Context.Current.InstallerPath, Context.Current.EdgeAgentBootstrapImage, bootstrapRegistry); }
protected async Task BeforeAllTestsAsync() { using var cts = new CancellationTokenSource(Context.Current.SetupTimeout); this.daemon = await OsPlatform.Current.CreateEdgeDaemonAsync( Context.Current.InstallerPath, cts.Token); }
public async Task BeforeAllAsync() { using var cts = new CancellationTokenSource(Context.Current.SetupTimeout); CancellationToken token = cts.Token; this.daemon = await OsPlatform.Current.CreateEdgeDaemonAsync( Context.Current.InstallerPath, token); await Profiler.Run( async() => { // Set up logging LogEventLevel consoleLevel = Context.Current.Verbose ? LogEventLevel.Verbose : LogEventLevel.Information; var loggerConfig = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.NUnit(consoleLevel); Context.Current.LogFile.ForEach(f => loggerConfig.WriteTo.File(f)); Log.Logger = loggerConfig.CreateLogger(); // Install IoT Edge, and do some basic configuration await this.daemon.UninstallAsync(token); await this.daemon.InstallAsync(Context.Current.PackagePath, Context.Current.Proxy, token); await this.daemon.ConfigureAsync( config => { var msgBuilder = new StringBuilder(); var props = new List <object>(); string hostname = Dns.GetHostName(); config.SetDeviceHostname(hostname); msgBuilder.Append("with hostname '{hostname}'"); props.Add(hostname); Context.Current.ParentHostname.ForEach(parentHostname => { config.SetParentHostname(parentHostname); msgBuilder.AppendLine(", parent hostname '{parentHostname}'"); props.Add(parentHostname); }); Context.Current.Proxy.ForEach(proxy => { config.AddHttpsProxy(proxy); msgBuilder.AppendLine(", proxy '{ProxyUri}'"); props.Add(proxy.ToString()); }); config.Update(); return(Task.FromResult((msgBuilder.ToString(), props.ToArray()))); }, token, restart: false); }, "Completed end-to-end test setup"); }
public SetupFixture() { this.daemon = OsPlatform.Current.CreateEdgeDaemon(Context.Current.InstallerPath); this.iotHub = new IotHub( Context.Current.ConnectionString, Context.Current.EventHubEndpoint, Context.Current.Proxy); }
protected async Task BeforeAllTestsAsync() { using var cts = new CancellationTokenSource(Context.Current.SetupTimeout); Option <Registry> bootstrapRegistry = Option.Maybe(Context.Current.Registries.FirstOrDefault()); this.daemon = await OsPlatform.Current.CreateEdgeDaemonAsync( Context.Current.InstallerPath, cts.Token); }
public SetupFixture() { Option <Registry> bootstrapRegistry = Option.Maybe(Context.Current.Registries.First()); this.daemon = OsPlatform.Current.CreateEdgeDaemon(Context.Current.InstallerPath, Context.Current.EdgeAgentBootstrapImage, bootstrapRegistry); this.iotHub = new IotHub( Context.Current.ConnectionString, Context.Current.EventHubEndpoint, Context.Current.Proxy); }
public async Task BeforeAllAsync() { using var cts = new CancellationTokenSource(Context.Current.SetupTimeout); CancellationToken token = cts.Token; Option <Registry> bootstrapRegistry = Option.Maybe(Context.Current.Registries.First()); this.daemon = await OsPlatform.Current.CreateEdgeDaemonAsync( Context.Current.InstallerPath, Context.Current.EdgeAgentBootstrapImage, bootstrapRegistry, token); await Profiler.Run( async() => { // Set up logging LogEventLevel consoleLevel = Context.Current.Verbose ? LogEventLevel.Verbose : LogEventLevel.Information; var loggerConfig = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.NUnit(consoleLevel); Context.Current.LogFile.ForEach(f => loggerConfig.WriteTo.File(f)); Log.Logger = loggerConfig.CreateLogger(); // Install IoT Edge, and do some basic configuration await this.daemon.UninstallAsync(token); await this.daemon.InstallAsync(Context.Current.PackagePath, Context.Current.Proxy, token); await this.daemon.ConfigureAsync( config => { var msg = string.Empty; var props = new object[] { }; config.SetDeviceHostname(Dns.GetHostName()); Context.Current.Proxy.ForEach(proxy => { config.AddHttpsProxy(proxy); msg = "with proxy '{ProxyUri}'"; props = new object[] { proxy.ToString() }; }); config.Update(); return(Task.FromResult((msg, props))); }, token, restart: false); }, "Completed end-to-end test setup"); }
public async Task BeforeAllAsync() { await Profiler.Run( async() => { (string, string, string)rootCa = Context.Current.RootCaKeys.Expect(() => new ArgumentException()); Option <Uri> proxy = Context.Current.Proxy; string deviceId = Context.Current.DeviceId; using (var cts = new CancellationTokenSource(Context.Current.SetupTimeout)) { CancellationToken token = cts.Token; this.iotHub = new IotHub( Context.Current.ConnectionString, Context.Current.EventHubEndpoint, proxy); this.ca = await CertificateAuthority.CreateAsync( deviceId, rootCa, Context.Current.CaCertScriptPath, token); this.daemon = OsPlatform.Current.CreateEdgeDaemon(Context.Current.InstallerPath); await this.daemon.ConfigureAsync( config => { config.SetCertificates(this.ca.Certificates); config.Update(); return(Task.FromResult(("with edge certificates", Array.Empty <object>()))); }, token); var runtime = new EdgeRuntime( deviceId, Context.Current.EdgeAgentImage, Context.Current.EdgeHubImage, proxy, Context.Current.Registries, Context.Current.OptimizeForPerformance, this.iotHub); await runtime.DeployConfigurationAsync(token); } }, "Completed custom certificate setup"); }
public ManualProvisioningFixture(string deviceIdSuffix) { this.daemon = OsPlatform.Current.CreateEdgeDaemon(Context.Current.InstallerPath); this.iotHub = new IotHub( Context.Current.ConnectionString, Context.Current.EventHubEndpoint, Context.Current.Proxy); this.runtime = new EdgeRuntime( Context.Current.DeviceId + deviceIdSuffix, Context.Current.EdgeAgentImage, Context.Current.EdgeHubImage, Context.Current.Proxy, Context.Current.Registries, Context.Current.OptimizeForPerformance, this.iotHub); }
public DeviceProvisioningFixture() { this.daemon = OsPlatform.Current.CreateEdgeDaemon(Context.Current.InstallerPath); }
public async Task BeforeAllAsync() { using var cts = new CancellationTokenSource(Context.Current.SetupTimeout); CancellationToken token = cts.Token; this.daemon = await OsPlatform.Current.CreateEdgeDaemonAsync( Context.Current.InstallerPath, token); await Profiler.Run( async() => { // Set up logging LogEventLevel consoleLevel = Context.Current.Verbose ? LogEventLevel.Verbose : LogEventLevel.Information; var loggerConfig = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.NUnit(consoleLevel); Context.Current.LogFile.ForEach(f => loggerConfig.WriteTo.File(f)); Log.Logger = loggerConfig.CreateLogger(); // Install IoT Edge, and do some basic configuration await this.daemon.UninstallAsync(token); await this.daemon.InstallAsync(Context.Current.PackagePath, Context.Current.Proxy, token); // Create a directory for the tests to store certs, keys, etc. Directory.CreateDirectory("/etc/aziot/e2e_tests"); // Backup any existing service config files. foreach (string file in this.configFiles) { if (File.Exists(file)) { File.Move(file, file + ".backup", true); } } await this.daemon.ConfigureAsync( config => { var msgBuilder = new StringBuilder(); var props = new List <object>(); string hostname = Context.Current.Hostname.GetOrElse(Dns.GetHostName()); config.SetDeviceHostname(hostname); msgBuilder.Append("with hostname '{hostname}'"); props.Add(hostname); Log.Information("Search parents"); Context.Current.ParentHostname.ForEach(parentHostname => { Log.Information($"Found parent hostname {parentHostname}"); config.SetParentHostname(parentHostname); msgBuilder.AppendLine(", parent hostname '{parentHostname}'"); props.Add(parentHostname); string edgeAgent = Regex.Replace(Context.Current.EdgeAgentImage.GetOrElse(string.Empty), @"\$upstream", parentHostname); config.SetEdgeAgentImage(edgeAgent); }); Context.Current.Proxy.ForEach(proxy => { config.AddHttpsProxy(proxy); msgBuilder.AppendLine(", proxy '{ProxyUri}'"); props.Add(proxy.ToString()); }); config.Update(); return(Task.FromResult((msgBuilder.ToString(), props.ToArray()))); }, token, restart: false); }, "Completed end-to-end test setup"); }