Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9184253
run windows UT's
matmerr Aug 25, 2022
8d99ad8
container image
matmerr Aug 25, 2022
d0e3100
remove container
matmerr Aug 30, 2022
2329f2f
coverage
matmerr Aug 31, 2022
52ce87b
run windows UT's
matmerr Aug 25, 2022
59ae57b
container image
matmerr Aug 25, 2022
2c3350b
remove container
matmerr Aug 30, 2022
0f72cf4
coverage
matmerr Aug 31, 2022
10996d0
fix UTs round 1
huntergregory Sep 6, 2022
feea2ae
passing UTs for policies pkg
huntergregory Sep 8, 2022
c9d9e24
Merge branch 'master' into windowsuts
matmerr Sep 9, 2022
862fbf3
Merge branch 'master' into windowsuts
matmerr Sep 12, 2022
7d09dd6
use canary pool
matmerr Sep 12, 2022
274b80c
Merge branch 'windowsuts' of github.com:matmerr/azure-container-netwo…
matmerr Sep 12, 2022
47cc542
remove bash from windows
matmerr Sep 14, 2022
5aeaa08
Merge branch 'master' into windowsuts
vakalapa Oct 11, 2022
caba7ac
fixed unit test
ck319 Oct 17, 2022
170b1c7
added skip for windows dp translate policy tests
ck319 Oct 17, 2022
9714765
lint updates and remove dataplane_windows_test.go
ck319 Oct 17, 2022
3624582
updated failing tests
ck319 Oct 19, 2022
89eb29f
Merge branch 'master' into windowsuts
ck319 Oct 19, 2022
3a34ea7
fix lint issue
ck319 Oct 19, 2022
4376d74
Merge branch 'windowsuts' of https://github.com/matmerr/azure-contain…
ck319 Oct 19, 2022
fe7728a
fixed remaining tests
ck319 Oct 19, 2022
4f77059
lint update
ck319 Oct 19, 2022
ff74f3c
undo last change
ck319 Oct 19, 2022
dcd950d
Merge branch 'master' into windowsuts
ck319 Oct 19, 2022
fc6ed1d
format update
ck319 Oct 20, 2022
e5d8df5
lint fix
ck319 Oct 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions .pipelines/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,24 @@ stages:
name: "Test"
displayName: "Run Tests"

- bash: |
build/tools/bin/gocov convert coverage.out > coverage.json
build/tools/bin/gocov-xml < coverage.json > coverage.xml
name: "Coverage"
displayName: "Generate Coverage Reports"
condition: always()

- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: report.xml
displayName: "Publish Test Results"
condition: always()

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: coverage.xml
displayName: "Publish Code Coverage Results"
condition: always()
- stage: test_windows
displayName: Test ACN Windows
dependsOn:
- setup
jobs:
- job: test
displayName: Run Tests
variables:
STORAGE_ID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.StorageID'] ]
pool:
name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS_ALT)"
steps:
- script: |
cd npm/
go test ./...
retryCountOnTaskFailure: 3
name: "TestWindows"
displayName: "Run Windows Tests"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: run make test-all-windows

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed to leave as is for now (also don't want to run non-npm tests)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need special treatment for windows (no make installed)


- stage: binaries
displayName: Build Binaries
Expand All @@ -109,7 +107,7 @@ stages:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- script: |
make all-binaries-platforms
make all-binaries-platforms
name: "BuildAllPlatformBinaries"
displayName: "Build all platform binaries"

Expand Down Expand Up @@ -255,7 +253,7 @@ stages:
strategy:
matrix:
acncli:
name: acncli
name: acncli
platforms: linux/amd64 linux/arm64
cni_dropgz:
name: cni-dropgz
Expand All @@ -274,6 +272,8 @@ stages:
parameters:
name: $(name)
platforms: $(platforms)
tag: $(TAG)


- template: singletenancy/cilium/cilium-e2e-job-template.yaml
parameters:
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,7 @@ COVER_PKG ?= .
test-all: ## run all unit tests.
@$(eval COVER_FILTER=`go list --tags ignore_uncovered,ignore_autogenerated $(COVER_PKG)/... | tr '\n' ','`)
@echo Test coverpkg: $(COVER_FILTER)
go test -mod=readonly -buildvcs=false -tags "unit" -coverpkg=$(COVER_FILTER) -race -covermode atomic -failfast -coverprofile=coverage.out $(COVER_PKG)/...

go test -mod=readonly -buildvcs=false -tags "unit" -coverpkg=$(COVER_FILTER) -race -covermode atomic -coverprofile=coverage.out $(COVER_PKG)/...

test-integration: ## run all integration tests.
CNI_DROPGZ_VERSION=$(CNI_DROPGZ_VERSION) \
Expand Down
12 changes: 11 additions & 1 deletion common/ioshim_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/Azure/azure-container-networking/network/hnswrapper"
testutils "github.com/Azure/azure-container-networking/test/utils"
"github.com/Microsoft/hcsshim/hcn"
utilexec "k8s.io/utils/exec"
)

Expand All @@ -21,9 +22,18 @@ func NewIOShim() *IOShim {
}

func NewMockIOShim(calls []testutils.TestCmd) *IOShim {
hns := hnswrapper.NewHnsv2wrapperFake()
network := &hcn.HostComputeNetwork{
Id: "1234",
Name: "azure",
}

// CreateNetwork will never return an error
_, _ = hns.CreateNetwork(network)

return &IOShim{
Exec: testutils.GetFakeExecWithScripts(calls),
Hns: hnswrapper.NewHnsv2wrapperFake(),
Hns: hns,
}
}

Expand Down
33 changes: 27 additions & 6 deletions network/hnswrapper/hnsv2wrapperfake.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func delayHnsCall(delay time.Duration) {
time.Sleep(delay)
}

// NewMockIOShim is dependent on this function never returning an error
func (f Hnsv2wrapperFake) CreateNetwork(network *hcn.HostComputeNetwork) (*hcn.HostComputeNetwork, error) {
f.Lock()
defer f.Unlock()
Expand Down Expand Up @@ -86,11 +87,14 @@ func (f Hnsv2wrapperFake) ModifyNetworkSettings(network *hcn.HostComputeNetwork,
}
if setpol.PolicyType != hcn.SetPolicyTypeIpSet {
// Check Nested SetPolicy members
members := strings.Split(setpol.Values, ",")
for _, memberID := range members {
_, ok := networkCache.Policies[memberID]
if !ok {
return newErrorFakeHNS(fmt.Sprintf("Member Policy %s not found", memberID))
// checking for the case of no members in nested policy. iMgrCfg.AddEmptySetToLists is set to false in some tests so it creates a nested policy with no members
if setpol.Values != "" {
members := strings.Split(setpol.Values, ",")
for _, memberID := range members {
_, ok := networkCache.Policies[memberID]
if !ok {
return newErrorFakeHNS(fmt.Sprintf("Member Policy %s not found", memberID))
}
}
}
}
Expand Down Expand Up @@ -401,11 +405,28 @@ func NewFakeHostComputeEndpoint(endpoint *hcn.HostComputeEndpoint) *FakeHostComp
}

func (fEndpoint *FakeHostComputeEndpoint) GetHCNObj() *hcn.HostComputeEndpoint {
return &hcn.HostComputeEndpoint{
// NOTE: not including other policy types like perhaps SetPolicies
hcnEndpoint := &hcn.HostComputeEndpoint{
Id: fEndpoint.ID,
Name: fEndpoint.Name,
HostComputeNetwork: fEndpoint.HostComputeNetwork,
Policies: make([]hcn.EndpointPolicy, 0),
}

for _, fakeEndpointPol := range fEndpoint.Policies {
rawJSON, err := json.Marshal(fakeEndpointPol)
if err != nil {
fmt.Printf("FAILURE marshalling fake endpoint policy: %s\n", err.Error())
} else {
hcnPolicy := hcn.EndpointPolicy{
Type: hcn.ACL,
Settings: rawJSON,
}
hcnEndpoint.Policies = append(hcnEndpoint.Policies, hcnPolicy)
}
}

return hcnEndpoint
}

func (fEndpoint *FakeHostComputeEndpoint) RemovePolicy(toRemovePol *FakeEndpointPolicy) error {
Expand Down
Loading