1
0
mirror of https://github.com/rclone/rclone.git synced 2025-03-23 04:34:32 +02:00
Ole Frost 5e91b93e59 cmdtest: end-to-end test for commands, flags and environment variables
There was no easy way to automatically test the end-to-end functionality
of commands, flags, environment variables etc.

The need for end-to-end testing was highlighted by the issues fixed
in #5341. There was no automated test to continually verify current
behaviour, nor a framework to quickly test the correctness of the fixes.

This change adds an end-to-end testing framework in the cmdtest folder.
It has some simple examples in func TestCmdTest in cmdtest_test.go. The
tests should be readable by anybody familiar with rclone and look like
this:

    // Test the rclone version command with debug logging (-vv)
    out, err = rclone("version", "-vv")
    if assert.NoError(t, err) {
        assert.Contains(t, out, "rclone v")
        assert.Contains(t, out, "os/version:")
        assert.Contains(t, out, " DEBUG : ")
    }

The end-to-end tests are executed just like the Go unit tests, that is:

    go test ./cmdtest -v

The change also contains a thorough test of environment variables in
environment_test.go.

Thanks to @ncw for encouragement and introduction to the TestMain trick.
2021-07-05 16:38:20 +01:00
..
2021-07-05 14:51:00 +01:00
2021-06-10 19:52:55 +03:00
2020-10-28 18:16:23 +00:00
2021-06-10 19:52:55 +03:00
2021-02-02 14:17:09 +00:00
2020-12-27 12:43:30 +00:00
2020-11-27 14:08:52 +00:00
2021-06-08 18:57:04 +03:00
2021-03-31 19:12:08 +01:00
2021-05-28 14:44:50 +01:00
2021-02-02 14:17:09 +00:00
2021-02-02 14:17:09 +00:00
2020-11-27 14:08:52 +00:00
2020-10-28 18:16:23 +00:00
2020-10-28 18:16:23 +00:00
2020-10-28 18:16:23 +00:00
2020-11-27 14:08:52 +00:00
2020-10-28 18:16:23 +00:00
2020-10-28 18:16:23 +00:00
2020-10-28 18:16:23 +00:00
2021-06-08 09:59:57 +01:00
2020-10-28 18:16:23 +00:00
2020-11-27 14:08:52 +00:00
2021-04-13 17:46:07 +02:00
2021-05-12 09:52:07 +01:00
2021-03-31 19:12:08 +01:00