VOL-2076 Unit Test cases for core.go

Change-Id: Ie003cd248478679404107d985c1a22a381e6348c
diff --git a/vendor/github.com/phayes/freeport/.gitignore b/vendor/github.com/phayes/freeport/.gitignore
new file mode 100644
index 0000000..1521c8b
--- /dev/null
+++ b/vendor/github.com/phayes/freeport/.gitignore
@@ -0,0 +1 @@
+dist
diff --git a/vendor/github.com/phayes/freeport/.goreleaser.yml b/vendor/github.com/phayes/freeport/.goreleaser.yml
new file mode 100644
index 0000000..48044ea
--- /dev/null
+++ b/vendor/github.com/phayes/freeport/.goreleaser.yml
@@ -0,0 +1,134 @@
+project_name: freeport
+
+release:
+  github:
+    owner: phayes
+    name: freeport
+
+builds:
+  - binary: freeport
+    goos:
+      - linux
+      - darwin
+    goarch:
+      - amd64
+      - "386"
+    goarm:
+      - "6"
+    main: ./cmd/freeport
+    ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
+
+archive:
+  format: tar.gz
+  name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{
+    .Arm }}{{ end }}'
+  files:
+  - licence*
+  - LICENCE*
+  - license*
+  - LICENSE*
+  - readme*
+  - README*
+  - changelog*
+  - CHANGELOG*
+
+snapshot:
+  name_template: SNAPSHOT-{{ .Commit }}
+
+checksum:
+  name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'
+
+# Create RPM and .DEB files
+fpm:
+  vendor: Patrick Hayes
+
+  # Your app's homepage.
+  #homepage: https://example.com/
+
+  # Your app's maintainer
+  maintainer: Patrick Hayes <patrick.d.hayes@gmail.com>
+
+  # Your app's description.
+  description: Get a free open TCP port that is ready to use.
+
+  # Your app's license.
+  # Default is empty.
+  license: BSD
+
+  # Formats to be generated.
+  formats:
+    - deb
+    - rpm
+
+  # Packages your package depends on.
+  #dependencies:
+  #  - git
+  #  - zsh
+
+  # Packages that conflict with your package.
+  #conflicts:
+  #  - svn
+  #  - bash
+
+  # Files or directories to add to your package (beyond the binary).
+  # Keys are source paths to get the files from.
+  # Values are the destination locations of the files in the package.
+  #files:
+  #  "scripts/etc/init.d/": "/etc/init.d"
+
+# Homebrew repos
+brew:
+  # Reporitory to push the tap to.
+  github:
+    owner: phayes
+    name: homebrew-repo
+
+  # Git author used to commit to the repository.
+  # Defaults are shown.
+  commit_author:
+    name: goreleaserbot
+    email: goreleaser@carlosbecker.com
+
+  # Folder inside the repository to put the formula.
+  # Default is the root folder.
+  # folder: .
+
+  # Caveats for the user of your binary.
+  # Default is empty.
+  # caveats: "How to use this binary"
+
+  # Your app's homepage.
+  # Default is empty.
+  # homepage: "https://example.com/"
+
+  # Your app's description.
+  # Default is empty.
+  description: "Get a free open TCP port that is ready to use."
+
+  # Packages your package depends on.
+  #dependencies:
+  #  - git
+  #  - zsh
+
+  # Packages that conflict with your package.
+  #conflicts:
+  #  - svn
+  #  - bash
+
+  # Specify for packages that run as a service.
+  # Default is empty.
+  #plist: |
+  #  <?xml version="1.0" encoding="UTF-8"?>
+  #  ...
+
+  # So you can `brew test` your formula.
+  # Default is empty.
+  #test: |
+  #  system "#{bin}/program --version"
+  #  ...
+
+  # Custom install script for brew.
+  # Default is 'bin.install "program"'.
+  #install: |
+  #  bin.install "program"
+  #  ...
\ No newline at end of file
diff --git a/vendor/github.com/phayes/freeport/LICENSE.md b/vendor/github.com/phayes/freeport/LICENSE.md
new file mode 100644
index 0000000..d9882e5
--- /dev/null
+++ b/vendor/github.com/phayes/freeport/LICENSE.md
@@ -0,0 +1,15 @@
+Open Source License (BSD 3-Clause)
+----------------------------------
+
+Copyright (c) 2014, Patrick Hayes / HighWire Press
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/phayes/freeport/README.md b/vendor/github.com/phayes/freeport/README.md
new file mode 100644
index 0000000..1665ccf
--- /dev/null
+++ b/vendor/github.com/phayes/freeport/README.md
@@ -0,0 +1,58 @@
+FreePort
+========
+
+Get a free open TCP port that is ready to use.
+
+## Command Line Example:
+```bash
+# Ask the kernel to give us an open port.
+export port=$(freeport)
+
+# Start standalone httpd server for testing
+httpd -X -c "Listen $port" &
+
+# Curl local server on the selected port
+curl localhost:$port
+```
+
+## Golang example:
+```go
+package main
+
+import "github.com/phayes/freeport"
+
+func main() {
+	port, err := freeport.GetFreePort()
+	if err != nil {
+		log.Fatal(err)
+	}
+	// port is ready to listen on
+}
+
+```
+
+## Installation
+
+#### Mac OSX
+```bash
+brew install phayes/repo/freeport
+```
+
+
+#### CentOS and other RPM based systems
+```bash
+wget https://github.com/phayes/freeport/releases/download/1.0.2/freeport_1.0.2_linux_386.rpm
+rpm -Uvh freeport_1.0.2_linux_386.rpm
+```
+
+#### Ubuntu and other DEB based systems
+```bash
+wget wget https://github.com/phayes/freeport/releases/download/1.0.2/freeport_1.0.2_linux_amd64.deb
+dpkg -i freeport_1.0.2_linux_amd64.deb
+```
+
+#### Building From Source
+```bash
+sudo apt-get install golang                    # Download go. Alternativly build from source: https://golang.org/doc/install/source
+go get github.com/phayes/freeport
+```
diff --git a/vendor/github.com/phayes/freeport/freeport.go b/vendor/github.com/phayes/freeport/freeport.go
new file mode 100644
index 0000000..fcfb6ba
--- /dev/null
+++ b/vendor/github.com/phayes/freeport/freeport.go
@@ -0,0 +1,49 @@
+package freeport
+
+import (
+	"net"
+)
+
+// GetFreePort asks the kernel for a free open port that is ready to use.
+func GetFreePort() (int, error) {
+	addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
+	if err != nil {
+		return 0, err
+	}
+
+	l, err := net.ListenTCP("tcp", addr)
+	if err != nil {
+		return 0, err
+	}
+	defer l.Close()
+	return l.Addr().(*net.TCPAddr).Port, nil
+}
+
+// GetPort is deprecated, use GetFreePort instead
+// Ask the kernel for a free open port that is ready to use
+func GetPort() int {
+	port, err := GetFreePort()
+	if err != nil {
+		panic(err)
+	}
+	return port
+}
+
+// GetFreePort asks the kernel for free open ports that are ready to use.
+func GetFreePorts(count int) ([]int, error) {
+	var ports []int
+	for i := 0; i < count; i++ {
+		addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
+		if err != nil {
+			return nil, err
+		}
+
+		l, err := net.ListenTCP("tcp", addr)
+		if err != nil {
+			return nil, err
+		}
+		defer l.Close()
+		ports = append(ports, l.Addr().(*net.TCPAddr).Port)
+	}
+	return ports, nil
+}