|
1 | | -# kudu-binary |
| 1 | +# Native Apache Kudu binaries for .NET testing |
| 2 | + |
| 3 | +This is the .NET equivalent of the Java binary jar as described here, https://kudu.apache.org/2019/03/19/testing-apache-kudu-applications-on-the-jvm.html |
| 4 | + |
| 5 | +**Important:** This nuget package contains Kudu binaries for use in a "mini cluster" environment for **testing only**. |
| 6 | + |
| 7 | +The binaries in this archive should never be deployed to run an actual Kudu |
| 8 | +service, whether in production or development, because many security-related |
| 9 | +dependencies are copied from the build system and will not be patched when the |
| 10 | +operating system on the runtime host is patched. |
| 11 | + |
| 12 | +## Usage |
| 13 | + |
| 14 | +Add the nuget package Knet.Kudu.Binary. This package will add the Apache Kudu binaries to your application's build output. |
| 15 | +This library also comes with a helper method to locate an Apache Kudu binary, `KuduBinaryLocator.FindBinary("kudu")`. |
| 16 | +This also returns environment variables that should be set when starting the Kudu process: |
| 17 | + |
| 18 | +```csharp |
| 19 | +var kuduExe = KuduBinaryLocator.FindBinary("kudu"); |
| 20 | +var workingDirectory = Path.GetDirectoryName(kuduExe.ExePath); |
| 21 | + |
| 22 | +var startInfo = new ProcessStartInfo |
| 23 | +{ |
| 24 | + FileName = kuduExe.ExePath, |
| 25 | + WorkingDirectory = workingDirectory, |
| 26 | + RedirectStandardInput = true, |
| 27 | + RedirectStandardOutput = true, |
| 28 | + RedirectStandardError = true, |
| 29 | + UseShellExecute = false, |
| 30 | + CreateNoWindow = true |
| 31 | +}; |
| 32 | + |
| 33 | +startInfo.ArgumentList.Add("test"); |
| 34 | +startInfo.ArgumentList.Add("mini_cluster"); |
| 35 | +startInfo.ArgumentList.Add("--serialization=pb"); |
| 36 | + |
| 37 | +foreach (var env in kuduExe.EnvironmentVariables) |
| 38 | +{ |
| 39 | + startInfo.EnvironmentVariables.Add(env.Key, env.Value); |
| 40 | +} |
| 41 | + |
| 42 | +var process = new Process(startInfo); |
| 43 | +process.Start(); |
| 44 | +``` |
0 commit comments