Example #1
0
func TestClientHelpFlag(t *testing.T) {
	var err error
	var fixture, stdout, stderr string
	for i, tt := range []string{"--help", "-h", "help", ""} {
		if tt == "" {
			stdout, stderr, err = util.RunFleetctl()
		} else {
			stdout, stderr, err = util.RunFleetctl(tt)
		}

		if err != nil {
			t.Fatalf("case %d: failed getting %s output: %v\n\nstdout: %s\n\nstderr: %s", i, tt, err, stdout, stderr)
		}

		// use the output of the first test case as the point
		// of comparison for all future cases
		if i == 0 {
			if len(stdout) == 0 {
				t.Fatalf("case 0: initial case has no help output")
			}
			fixture = stdout
			continue
		}

		if stdout != fixture {
			t.Errorf("case %d: stdout:\n%s\n\ndiffers from stdout of case 0:\n%s", i, stdout, fixture)
		}
	}
}
Example #2
0
func TestClientVersionHelpOutput(t *testing.T) {
	stdout, _, err := util.RunFleetctl()
	if err != nil {
		t.Fatalf("Unexpected error while executing fleetctl: %v", err)
	}

	if !strings.Contains(stdout, fmt.Sprintf("%s", version.Version)) {
		t.Fatalf("Could not find expected version string (%s) in help output:\n%s", version.Version, stdout)
	}
}
Example #3
0
func TestClientVersionFlag(t *testing.T) {
	stdout, _, err := util.RunFleetctl("--version")
	if err != nil {
		t.Fatalf("Unexpected error while executing fleetctl: %v", err)
	}

	if strings.TrimSpace(stdout) != fmt.Sprintf("fleetctl version %s", version.Version) {
		t.Fatalf("Received unexpected output for `fleetctl --version`: '%s'", stdout)
	}
}
Example #4
0
func (nc *nspawnCluster) FleetctlWithEnv(m Member, args ...string) (string, string, error) {
	handleEndpointFlag(m, true, &args)
	return util.RunFleetctl(args...)
}
Example #5
0
func (nc *nspawnCluster) Fleetctl(args ...string) (string, string, error) {
	args = append([]string{"--etcd-key-prefix=" + nc.keyspace()}, args...)
	return util.RunFleetctl(args...)
}
Example #6
0
func (nc *nspawnCluster) Fleetctl(m Member, args ...string) (string, string, error) {
	args = append([]string{"--experimental-api", "--endpoint=" + m.Endpoint()}, args...)
	return util.RunFleetctl(args...)
}