Merge lp:~elopio/snappy/test_go_search into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Leo Arias
Status: Merged
Approved by: Leo Arias
Approved revision: 580
Merged at revision: 584
Proposed branch: lp:~elopio/snappy/test_go_search
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 57 lines (+44/-4)
2 files modified
_integration-tests/tests/06_test_search_framework (+0/-4)
_integration-tests/tests/latest/search_test.go (+44/-0)
To merge this branch: bzr merge lp:~elopio/snappy/test_go_search
Reviewer Review Type Date Requested Status
Federico Gimenez (community) Approve
Review via email: mp+264793@code.launchpad.net

Commit message

Translated the search integration test to go.

To post a comment you must log in.
Revision history for this message
Federico Gimenez (fgimenez) wrote :

Looks good, IMO it would be nice to be able to test different scenarios here (perhaps in other tests too) through table driven tests [1], what do you think?

Thanks!

[1] https://code.google.com/p/go-wiki/wiki/TableDrivenTests

Revision history for this message
Leo Arias (elopio) wrote :

I'm torn about this. I mean, of course tests with scenarios are cool, and I want them. But I'm not sure how many scenarios we should cover in the integration suite. Maybe we should search for an app and a framework, I don't know searching for more stuff would be of value.

Revision history for this message
Federico Gimenez (fgimenez) wrote :

We can go ahead with this and discuss how and when to use the table driven tests, maybe for the basic happy/unhappy installation cases, snap and framework, etc.

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '_integration-tests/tests/06_test_search_framework'
2--- _integration-tests/tests/06_test_search_framework 2015-06-15 15:36:29 +0000
3+++ _integration-tests/tests/06_test_search_framework 1970-01-01 00:00:00 +0000
4@@ -1,4 +0,0 @@
5-test() {
6- T="$framework[[:space:]]+[0-9.]+[[:space:]]+.*"
7- test_regexp "$T" $SNAPPY search "$framework"
8-}
9
10=== added file '_integration-tests/tests/latest/search_test.go'
11--- _integration-tests/tests/latest/search_test.go 1970-01-01 00:00:00 +0000
12+++ _integration-tests/tests/latest/search_test.go 2015-07-15 05:55:07 +0000
13@@ -0,0 +1,44 @@
14+// -*- Mode: Go; indent-tabs-mode: t -*-
15+
16+/*
17+ * Copyright (C) 2015 Canonical Ltd
18+ *
19+ * This program is free software: you can redistribute it and/or modify
20+ * it under the terms of the GNU General Public License version 3 as
21+ * published by the Free Software Foundation.
22+ *
23+ * This program is distributed in the hope that it will be useful,
24+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
25+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26+ * GNU General Public License for more details.
27+ *
28+ * You should have received a copy of the GNU General Public License
29+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
30+ *
31+ */
32+
33+package latest
34+
35+import (
36+ . "../common"
37+
38+ . "gopkg.in/check.v1"
39+)
40+
41+var _ = Suite(&searchSuite{})
42+
43+type searchSuite struct {
44+ SnappySuite
45+}
46+
47+func (s *searchSuite) TestSearchFrameworkMustPrintMatch(c *C) {
48+ searchOutput := ExecCommand(c, "snappy", "search", "hello-dbus-fwk")
49+
50+ expected := "(?ms)" +
51+ "Name +Version +Summary *\n" +
52+ ".*" +
53+ "^hello-dbus-fwk +.* +hello-dbus-fwk *\n" +
54+ ".*"
55+
56+ c.Assert(searchOutput, Matches, expected)
57+}

Subscribers

People subscribed via source and target branches