public async Task Attach() { var channel = TestHelper.CreateChannel(); var controller = new Controller.ControllerClient(channel); var request = new CreateVolumeRequest { Name = namingProvider.VolumeName(), }; populateSecretsFromEnv(request.ControllerCreateSecrets); var response = await controller.CreateVolumeAsync(request, null); Assert.NotNull(response.Volume); Assert.NotNull(response.Volume.Id); var volId = response.Volume.Id; var node = new Node.NodeClient(TestHelper.CreateChannel()); var tmppath = Path.Combine(Path.GetTempPath(), namingProvider.DirName()); try { var npr = new NodePublishVolumeRequest { VolumeId = volId, TargetPath = tmppath, }; populateSecretsFromEnv(npr.NodePublishSecrets); await node.NodePublishVolumeAsync(npr, null); var tmpfile = Path.Combine(tmppath, namingProvider.FileName()); var content = DateTimeOffset.UtcNow.ToString(); await File.AppendAllTextAsync(tmpfile, content); // TODO valid content through storage API, and enable DeleteVolumeAsync } finally { await node.NodeUnpublishVolumeAsync(new NodeUnpublishVolumeRequest { VolumeId = volId, TargetPath = tmppath, }, null); /* * await controller.DeleteVolumeAsync(new DeleteVolumeRequest * { * VolumeId = volId, * }); */ } }
public static void start() { channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure); client = new Controller.ControllerClient(channel); }