tests, integration-tests: port interfaces cli to spread #1382

Merged
merged 1 commit into from Jun 22, 2016
Jump to file or symbol
Failed to load files and symbols.
+35 −47
Split
@@ -1,47 +0,0 @@
-// -*- Mode: Go; indent-tabs-mode: t -*-
-// +build !excludeintegration
-
-/*
- * Copyright (C) 2016 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package tests
-
-import (
- "fmt"
-
- "gopkg.in/check.v1"
-
- "github.com/snapcore/snapd/integration-tests/testutils/cli"
- "github.com/snapcore/snapd/integration-tests/testutils/common"
-)
-
-var _ = check.Suite(&interfacesCliTest{})
-
-type interfacesCliTest struct {
- common.SnappySuite
-}
-
-// SNAP_INTERFACES_006: snap interfaces -i=<slot>
-func (s *interfacesCliTest) TestFilterBySlot(c *check.C) {
- plug := "network"
-
- expected := fmt.Sprintf("Slot +Plug\n:%s +-\n", plug)
-
- actual := cli.ExecCommand(c, "snap", "interfaces", "-i", plug)
-
- c.Assert(actual, check.Matches, expected)
-}
@@ -0,0 +1,35 @@
+summary: Check the interfaces command
+
+environment:
+ SNAP_NAME: network-consumer
+ SNAP_FILE: "./$[SNAP_NAME]_1.0_all.snap"
+ PLUG: network
+
+prepare: |
+ echo "Given a snap with the $PLUG plug is installed"
+ snapbuild ../lib/snaps/$SNAP_NAME .
@kyrofa

kyrofa Jun 22, 2016

Member

The network-consumer snap isn't in here-- note the test failure.

@fgimenez

fgimenez Jun 22, 2016

Contributor

@kyrofa yeap, this PR requires #1367, which carries network-consumer, once that's in this should be fine

Thanks!

@kyrofa

kyrofa Jun 22, 2016

Member

Haha, okay, tests are failing on master now, caught me by surprise.

+ snap install $SNAP_FILE
+
+restore: |
+ sudo snap remove $SNAP_NAME
+ rm -f $SNAP_FILE
+
+execute: |
+ expected="(?s)Slot +Plug\n\
+ :$PLUG +$SNAP_NAME"
+
+ echo "When the interfaces list is restricted by slot"
+ actual=$(snap interfaces -i $PLUG)
+
+ echo "Then only the requested slots are shown"
+ echo "$actual" | grep -Pzq "$expected"
+
+ echo "==============================================="
+
+ echo "When the interfaces list is restricted by slot and snap"
+ actual=$(snap interfaces -i $PLUG $SNAP_NAME)
+
+ echo "Then only the requested slots are shown"
+ echo "$actual" | grep -Pzq "$expected"
+
+ echo "==============================================="