-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bazel: allow "bazel test" to work without cgo dependencies
- Loading branch information
Showing
10 changed files
with
154 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
//go:build linux && cgo | ||
|
||
/* | ||
Copyright (c) Edgeless Systems GmbH | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//go:build cgo | ||
|
||
/* | ||
Copyright (c) Edgeless Systems GmbH | ||
SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
package server | ||
|
||
import ( | ||
"github.com/edgelesssys/constellation/v2/hack/qemu-metadata-api/virtwrapper" | ||
"libvirt.org/go/libvirt" | ||
) | ||
|
||
type stubNetwork struct { | ||
leases []libvirt.NetworkDHCPLease | ||
getLeaseErr error | ||
} | ||
|
||
func newStubNetwork(leases []virtwrapper.NetworkDHCPLease, getLeaseErr error) stubNetwork { | ||
libvirtLeases := make([]libvirt.NetworkDHCPLease, len(leases)) | ||
for i, l := range leases { | ||
libvirtLeases[i] = libvirt.NetworkDHCPLease{ | ||
IPaddr: l.IPaddr, | ||
Hostname: l.Hostname, | ||
} | ||
} | ||
return stubNetwork{ | ||
leases: libvirtLeases, | ||
getLeaseErr: getLeaseErr, | ||
} | ||
} | ||
|
||
func (n stubNetwork) GetDHCPLeases() ([]libvirt.NetworkDHCPLease, error) { | ||
return n.leases, n.getLeaseErr | ||
} | ||
|
||
func (n stubNetwork) Free() error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//go:build !cgo | ||
|
||
/* | ||
Copyright (c) Edgeless Systems GmbH | ||
SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
package server | ||
|
||
import "github.com/edgelesssys/constellation/v2/hack/qemu-metadata-api/virtwrapper" | ||
|
||
type stubNetwork struct { | ||
leases []virtwrapper.NetworkDHCPLease | ||
getLeaseErr error | ||
} | ||
|
||
func newStubNetwork(leases []virtwrapper.NetworkDHCPLease, getLeaseErr error) stubNetwork { | ||
return stubNetwork{ | ||
leases: leases, | ||
getLeaseErr: getLeaseErr, | ||
} | ||
} | ||
|
||
func (n stubNetwork) GetDHCPLeases() ([]virtwrapper.NetworkDHCPLease, error) { | ||
return n.leases, n.getLeaseErr | ||
} | ||
|
||
func (n stubNetwork) Free() error { | ||
return nil | ||
} |
Oops, something went wrong.