The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6850
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === And tests. Will be used in forth coming bridged filtering dnsmasq improvements. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From f8688c2b816813484965927804ddb5d89ead503f Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Fri, 7 Feb 2020 09:42:21 +0000 Subject: [PATCH] lxd/project: Adds Parts() function for separating project prefixed string And tests. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/project/project_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lxd/project/project_test.go diff --git a/lxd/project/project_test.go b/lxd/project/project_test.go new file mode 100644 index 0000000000..7382757263 --- /dev/null +++ b/lxd/project/project_test.go @@ -0,0 +1,36 @@ +package project_test + +import ( + "fmt" + + "github.com/lxc/lxd/lxd/project" +) + +func ExamplePrefix() { + prefixed := project.Prefix(project.Default, "test") + fmt.Println(prefixed) + + prefixed = project.Prefix("proj", "test_1") + fmt.Println(prefixed) + // Output: test + // proj_test_1 +} + +func ExampleParts() { + projectName, name := project.Parts("unprefixed") + fmt.Println(projectName, name) + + projectName, name = project.Parts(project.Prefix(project.Default, "test")) + fmt.Println(projectName, name) + + projectName, name = project.Parts("proj_test") + fmt.Println(projectName, name) + + projectName, name = project.Parts(project.Prefix("proj", "test_1")) + fmt.Println(projectName, name) + + // Output: default unprefixed + // default test + // proj test + // proj test_1 +}
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel