Skip to content

Commit

Permalink
Merge b27732c into c7a08b6
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Dec 8, 2020
2 parents c7a08b6 + b27732c commit d7f6976
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 44 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,83 @@

# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: CI

on: [push, pull_request]

jobs:
Tests:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

# just for easier debugging...
- name: Inspect Installed Packages
run: rpm -qa | sort

- name: Unit Tests
run: rake test:unit
# enable code coverage reporting
env:
COVERAGE: 1

# send the coverage report to coveralls.io
- name: Coveralls Report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

# FIXME: Rubocop is not used here
# Rubocop:
# runs-on: ubuntu-latest
# container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

# steps:

# - name: Git Checkout
# uses: actions/checkout@v2

# - name: Rubocop
# run: rake check:rubocop

Package:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

- name: Package Build
run: yast-ci-ruby -o package

Yardoc:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

- name: Yardoc
run: rake check:doc

# downloading the Docker image takes some time so bundling several fast
# checks into one job avoids that overhead
Checks:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

- name: POT Check
run: rake check:pot
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions Dockerfile

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
@@ -1,5 +1,6 @@
# YaST - The FCoE Client Module #

[![Travis Build](https://travis-ci.org/yast/yast-fcoe-client.svg?branch=master)](https://travis-ci.org/yast/yast-fcoe-client)
[![Jenkins Build](http://img.shields.io/jenkins/s/https/ci.opensuse.org/yast-fcoe-client-master.svg)](https://ci.opensuse.org/view/Yast/job/yast-fcoe-client-master/)

[![Workflow Status](https://github.com/yast/yast-fcoe-client/workflows/CI/badge.svg?branch=master)](
https://github.com/yast/yast-fcoe-client/actions?query=branch%3Amaster)
[![Jenkins Status](https://ci.opensuse.org/buildStatus/icon?job=yast-yast-fcoe-client-master)](
https://ci.opensuse.org/view/Yast/job/yast-yast-fcoe-client-master/)
32 changes: 14 additions & 18 deletions test/DetectNetworkCards_spec.rb
Expand Up @@ -3,37 +3,34 @@
Yast.import "FcoeClient"

describe Yast::FcoeClientClass do
before :each do
@fcoe = Yast::FcoeClientClass.new
@fcoe.main()

@test_class = @fcoe
subject { Yast::FcoeClient }

@test_class.stub(:GetVlanInterfaces).and_return({ "eth1" => [{ "vlan" => "400", "fcf" => "00:0d:ec:a2:ef:00" },
before :each do
allow(subject).to receive(:GetVlanInterfaces).and_return({ "eth1" => [{ "vlan" => "400", "fcf" => "00:0d:ec:a2:ef:00" },
{ "vlan" => "300", "fcf" => "00:0d:ec:a2:ef:01" }],
"eth2" => [{ "vlan" => "200", "fcf" => "00:0d:ec:a2:ef:02" }]})

@test_class.stub(:GetFcoeVlanInterface).with("eth1", "400").and_return("eth1.400")
@test_class.stub(:GetFcoeVlanInterface).with("eth1", "300").and_return("")
@test_class.stub(:GetFcoeVlanInterface).with("eth2", "200").and_return("")
allow(subject).to receive(:GetFcoeVlanInterface).with("eth1", "400").and_return("eth1.400")
allow(subject).to receive(:GetFcoeVlanInterface).with("eth1", "300").and_return("")
allow(subject).to receive(:GetFcoeVlanInterface).with("eth2", "200").and_return("")

@test_class.stub(:FcoeOnOnterface?).and_return(false)
allow(subject).to receive(:FcoeOnInterface?).and_return(false)

@test_class.stub(:GetFcoeStatus).with("eth1.400", "eth1").and_return({
allow(subject).to receive(:GetFcoeStatus).with("eth1.400", "eth1").and_return({
"AUTO_VLAN" => "no",
"DCB_REQUIRED"=>"yes",
"FCOE_ENABLE" => "yes",
"cfg_device" => "eth1.400"
})
@test_class.stub(:GetFcoeStatus).with("eth1.300", "eth1").and_return({})
@test_class.stub(:GetFcoeStatus).with("eth2.200", "eth2").and_return({})
allow(subject).to receive(:GetFcoeStatus).with("eth1.300", "eth1").and_return({})
allow(subject).to receive(:GetFcoeStatus).with("eth2.200", "eth2").and_return({})

@test_class.stub(:DCBCapable).and_return("no")
allow(subject).to receive(:DCBCapable).and_return("no")
end

context "with valid argument (a list of maps containing hwinfo about netcards)" do
it "#DetectNetworkCards returns a list of maps containing card info extended by vlan/fcoe info" do
answer = @test_class.DetectNetworkCards([
answer = subject.DetectNetworkCards([
{
"bus" => "PCI",
"bus_hwcfg" => "pci",
Expand All @@ -59,7 +56,7 @@
"iscsioffload"=> false
}
])
answer.should eq([
expect(answer). to eq([
{
"auto_vlan" => "yes",
"cfg_device"=> "",
Expand Down Expand Up @@ -109,8 +106,7 @@

context "with empty list as argument" do
it "#DetectNetworkCards returns empty list" do
answer = @test_class.DetectNetworkCards([])
answer.should eq([])
expect(subject.DetectNetworkCards([])).to eq([])
end
end

Expand Down
26 changes: 21 additions & 5 deletions test/test_helper.rb
Expand Up @@ -5,6 +5,14 @@
require "yast"
require "yast/rspec"

RSpec.configure do |config|
config.mock_with :rspec do |c|
# make sure we mock only the existing methods
# https://relishapp.com/rspec/rspec-mocks/v/3-0/docs/verifying-doubles/partial-doubles
c.verify_partial_doubles = true
end
end

if ENV["COVERAGE"]
require "simplecov"
SimpleCov.start do
Expand All @@ -14,12 +22,20 @@
# track all ruby files under src
SimpleCov.track_files("#{srcdir}/**/*.rb")

# use coveralls for on-line code coverage reporting at Travis CI
if ENV["TRAVIS"]
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
# additionally use the LCOV format for on-line code coverage reporting at CI
if ENV["CI"] || ENV["COVERAGE_LCOV"]
require "simplecov-lcov"

SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
# this is the default Coveralls GitHub Action location
# https://github.com/marketplace/actions/coveralls-github-action
c.single_report_path = "coverage/lcov.info"
end

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
SimpleCov::Formatter::LcovFormatter
]
end
end

0 comments on commit d7f6976

Please sign in to comment.