From 848293671b5d9c31ce3eb9ad8a1f130edd0ee7c5 Mon Sep 17 00:00:00 2001 From: Mura Li Date: Mon, 6 Mar 2017 22:13:17 +0800 Subject: Add basic integration test infrastructure (and new endpoint `/api/v1/version` for testing it) (#741) * Implement '/api/v1/version' * Cleanup and various fixes * Enhance run.sh * Add install_test.go * Add parameter utils.Config for testing handlers * Re-organize TestVersion.go * Rename functions * handling process cleanup properly * Fix missing function renaming * Cleanup the 'retry' logic * Cleanup * Remove unneeded logging code * Logging messages tweaking * Logging message tweaking * Fix logging messages * Use 'const' instead of hardwired numbers * We don't really need retries anymore * Move constant ServerHttpPort to install_test.go * Restore mistakenly removed constant * Add required comments to make the linter happy. * Fix comments and naming to address linter's complaints * Detect Gitea executale version automatically * Remove tests/run.sh, `go test` suffices. * Make `make build` a prerequisite of `make test` * Do not sleep before trying * Speedup the server pinging loop * Use defined const instead of hardwired numbers * Remove redundant error handling * Use a dedicated target for running code.gitea.io/tests * Do not make 'test' depend on 'build' target * Rectify the excluded package list * Remove redundant 'exit 1' * Change the API to allow passing test.T to test handlers * Make testing.T an embedded field * Use assert.Equal to comparing results * Add copyright info * Parametrized logging output * Use tmpdir instead * Eliminate redundant casting * Remove unneeded variable * Fix last commit * Add missing copyright info * Replace fmt.Fprintf with fmt.Fprint * rename the xtest to integration-test * Use Symlink instead of hard-link for cross-device linking * Turn debugging logs on * Follow the existing framework for APIs * Output logs only if test.v is true * Re-order import statements * Enhance the error message * Fix comment which breaks the linter's rule * Rename 'integration-test' to 'e2e-test' for saving keystrokes * Add comment to avoid possible confusion * Rename tests -> integration-tests Also change back the Makefile to use `make integration-test`. * Use tests/integration for now * tests/integration -> integrations Slightly flattened directory hierarchy is better. * Update Makefile accordingly * Fix a missing change in Makefile * govendor update code.gitea.io/sdk/gitea * Fix comment of struct fields * Fix conditional nonsense * Fix missing updates regarding version string changes * Make variable naming more consistent * Check http status code * Rectify error messages --- vendor/code.gitea.io/sdk/gitea/miscellaneous.go | 11 +++++++++++ vendor/vendor.json | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'vendor') diff --git a/vendor/code.gitea.io/sdk/gitea/miscellaneous.go b/vendor/code.gitea.io/sdk/gitea/miscellaneous.go index 30aaee77c8..dc56177ca6 100644 --- a/vendor/code.gitea.io/sdk/gitea/miscellaneous.go +++ b/vendor/code.gitea.io/sdk/gitea/miscellaneous.go @@ -11,3 +11,14 @@ type MarkdownOption struct { Context string Wiki bool } + +// ServerVersion wraps the version of the server +type ServerVersion struct { + Version string +} + +// ServerVersion returns the version of the server +func (c *Client) ServerVersion() (string, error) { + v := ServerVersion{} + return v.Version, c.getParsedResponse("GET", "/api/v1/version", nil, nil, &v) +} diff --git a/vendor/vendor.json b/vendor/vendor.json index afe768a0be..78ae8f3ff0 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -9,10 +9,10 @@ "revisionTime": "2017-02-22T02:52:05Z" }, { - "checksumSHA1": "K0VWBaa3ZUE598zVFGavdLB7vW4=", + "checksumSHA1": "qXD1HI8bTn7qNJZJOeZqQgxo354=", "path": "code.gitea.io/sdk/gitea", - "revision": "06902fe19508c7ede2be38b71287c665efa1f10d", - "revisionTime": "2017-02-19T11:17:32Z" + "revision": "8807a1d2ced513880b288a5e2add39df6bf72144", + "revisionTime": "2017-03-04T10:22:44Z" }, { "checksumSHA1": "IyfS7Rbl6OgR83QR7TOfKdDCq+M=", -- cgit v1.2.3