in brickmux tests. Increase waiting time for bricks to sign in and
add sleep whereever a new gd2 instance is respawned to give enough time
to bricks to sign in properly and multiplex.
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
..as mount.glusterfs utility might be installed in non-standard
location in test environments.
Besides, mounts in real code (volume status) already uses the binary
to mount and not the mount utility script.
Signed-off-by: Prashanth Pai <ppai@redhat.com>
On Volume delete,
- Unmount the Brick if mounted
- Remove LV
- Remove Thinpool if number of Lvs in the thinpool is zero
Fixes: #938
Signed-off-by: Aravinda VK <avishwan@redhat.com>
This change establishes the ability for the e2e tests to
start an etcd instance that all glusterd2 instances under
test will use, but that is not managed by glusterd2's
internal elastic etcd feature.
A new flag and corresponding global is established to control
whether the glusterd2 instances should use the internal,
elastic etcd, mode or if they should rely on an externally
deployed etcd instance. The flag -external-etcd is used to
control whether the testCluster instance will start up etcd
and have glusterd2 use it or not.
Note that this etcd instance is still internal to the test suite
and the tests should only require an etcd binary on the path.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The system is going to grow more services that need management.
Instead of passing a gds array around pass a higher level
testCluster type
Signed-off-by: John Mulligan <jmulligan@redhat.com>
instead of passing LocalStateDir and ClientAddress
of gdProcess to initRestClient function,
pass gdProcess object to initRestClient
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
if a restauth key is missing in config
file or if restauth is set to true,
glusterd2 will do token authentication.
Authentication can be disabled by
by setting restauth key in the configuration
to false.
updated test cases to use authentication
if auth file is present
added default rest authentication in glustercli
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
Also:
* Make setupCluster() use the restclient to do peer operations
* Bump up default wait time to check if gd2 is alive from 1.5s to 2s
* Ensure cleanup happens in all failure cases
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Add a helper function for tests that need unique test dirs that
creates test directories like /[base]/[testname]/[unique].
Signed-off-by: John Mulligan <jmulligan@redhat.com>
quota enable and disable as a volume set option
The daemon start and stop are called using the actor
framework.
Updates: #421
Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
For all practical purposes, in real usage and in tests, the configurable
paths `workdir` and `localstatedir` are set to the same directory which
defaults to `/var/lib/glusterd2` or `/user/local/var/lib/glusterd2`
Unlike glusterd1, glusterd2 does not daemonize itself. The working
directory of the process can be meaningfully set to either current
working directory from where glusterd2 process is started or to
`localstatedir` where glusterd2 stores all its data. We choose the
latter.
This change also reduces ambiguity for users and one less thing to
configure.
Signed-off-by: Prashanth Pai <ppai@redhat.com>
The localstatedir from config file contained relative path which was
not being converted to absolute path before passing as command line
argument to glusterd2.
Unexported UpdateDirs() as it was only used internally.
Signed-off-by: Prashanth Pai <ppai@redhat.com>
...and not in SendHTTPError(). This will ensure that these response
headers are always sent to client in all responses.
Earlier, for APIs such as /statedump, the headers were not sent in
response as it's handler did not have to invoke any restutils.*
functions.
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Deleting the workdir when tearing down deletes the logs and
other evidence needed to debug failing tests. The e2e main
function already deletes the top-level working dir at the
start of the tests and we recently added the ability to
use custom workdirs for different test runs.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, e2e tests were hard-coding the base workdir in
the main_test.go file and in the config toml files. This change
centralizes the base path in a top-level variable and makes
it possible to specify custom values for the workdir. This
can be useful if /tmp is inappropriate for this task on a
particular system or if multiple e2e tests are to be run in
parallel so that the caller may specify unique paths for
each test.
The toml files are adjusted to contain relative paths.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
* Bumped up sleep at two places hoping that it'll reduce chances of
failure. Elastic etcd almost never works reliably on my machine :(
* Tear down cluster will now kill daemons spawned by glusterd2.
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Added REST API authentication middleware. On Glusterd2 start, it
generates `$WORKDIR/auth` file with random string if not exists.
Local CLI/Curl can use that auth file and add Authorization request.
Note: User management is not covered in this patch. Limited to local
consumers only who can access `$WORKDIR/auth`. Auth is disabled by
default which can be enabled using config file option `restauth=true`
CLI needs new flag `--auth-file` to accept path for auth file similar
to Glusterd1 CLI flag `glusterd-sock`
Updates: #252
Signed-off-by: Aravinda VK <avishwan@redhat.com>
REST Client for Glusterd2 APIs. Initially these APIs will be used by
CLI project, it can be used by any application which is written in Go
lang.
Example:
package main
import (
"fmt"
"github.com/gluster/glusterd2/pkg/restclient"
)
func main(){
client := restclient.NewRESTClient("http://localhost:24007", "", "")
err := client.VolumeStart("gv1")
if err != nil{
fmt.Println("Failed to Start Volume gv1")
} else{
fmt.Println("Started Volume gv1 successfully")
}
}
Signed-off-by: Aravinda VK mail@aravindavk.in
Updates: #265
I assumed assert() will exit the test, but it's require() that exits
the test being run when the condition being tested is false.
Signed-off-by: Prashanth Pai <ppai@redhat.com>