Skip to content

Commit 7cf632c

Browse files
authored
AINFRA-283 - Set queue: mac explicitly in pipeline (#147)
2 parents ca68d7e + 65c49c9 commit 7cf632c

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed

.buildkite/pipeline.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
agents:
5+
queue: mac
6+
7+
env:
8+
IMAGE_ID: xcode-16.4
9+
110
# Nodes with values to reuse in the pipeline.
211
common_params:
312
plugins: &common_plugins
4-
- automattic/a8c-ci-toolkit#3.7.1
5-
# Common environment values to use with the `env` key.
6-
env: &common_env
7-
IMAGE_ID: xcode-16.1-v4
13+
- automattic/a8c-ci-toolkit#5.3.1
814

915
# This is the default pipeline – it will build and test the app
1016
steps:
@@ -17,10 +23,7 @@ steps:
1723
echo "--- :swift: Building + Testing"
1824
install_swiftpm_dependencies
1925
swift test
20-
env: *common_env
2126
plugins: *common_plugins
22-
agents:
23-
queue: "mac"
2427

2528
#################
2629
# Lint
@@ -44,10 +47,7 @@ steps:
4447
install_gems
4548
bundle exec fastlane set_up_signing
4649
make build verify-signing
47-
env: *common_env
4850
plugins: *common_plugins
49-
agents:
50-
queue: "mac"
5151

5252
#################
5353
# Publish the Binary (if we're building a tag)
@@ -59,11 +59,8 @@ steps:
5959
bundle exec fastlane set_up_signing
6060
make build
6161
bundle exec fastlane upload_release
62-
env: *common_env
6362
plugins: *common_plugins
6463
depends_on:
6564
- "test"
6665
- "validate-release-build"
6766
if: build.tag != null
68-
agents:
69-
queue: "mac"

Tests/libhostmgrTests/TestHelpers.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ extension S3Object {
1818
}
1919
}
2020

21-
extension XCTest {
22-
func XCTAssert(_ data: Data, hasHash hash: String, file: StaticString = #file, line: UInt = #line) {
23-
var hasher = SHA256()
24-
hasher.update(data: data)
25-
XCTAssertEqual(Data(hasher.finalize()).base64EncodedString(), hash, file: file, line: line)
26-
}
27-
}
28-
2921
func getPathForEnvFile(named key: String) -> URL {
3022
Bundle.module.url(forResource: key, withExtension: "env")!
3123
}

Tests/libhostmgrTests/VM/VMConfigFileTests.swift

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,36 @@ final class VMConfigFileTests: XCTestCase {
2727
}
2828

2929
func testThatHardwareModelIsParsedCorrectly() throws {
30-
XCTAssert(
31-
try configFileSample1.hardwareModel.dataRepresentation,
32-
hasHash: "3aTbdKrJ+27C8JaCzSmHNr32t5IbeuA5VjC48XCcGu8="
33-
)
30+
let dataRep = try configFileSample1.hardwareModel.dataRepresentation
31+
// The `dataRepresentation` is supposed to be an opaque value / implementation detail,
32+
// but that's the only property we have access to and we can thus use for testing correct parsing.
33+
//
34+
// This `dataRepresentation` happens to be a binary plist representation of a NSDictionary.
35+
// We can't just compare the `dataRepresentation` directly with a fixed value though, because different
36+
// versions of macOS might serialize the exact same NSDictionary as a slightly different NSData representation.
37+
// Besides, future macOS versions might add additional keys in that internal representation of those objects.
38+
//
39+
// So the best we can do is check that the `dataRepresentation` is not nil and check some keys in that dict.
40+
// This is a bit fragile but at least it's more resilient than comparing the `dataRepresentation` directly.
41+
let dictRep = try XCTUnwrap(PropertyListSerialization.propertyList(from: dataRep, format: nil) as? NSDictionary)
42+
XCTAssertEqual(dictRep["MinimumSupportedOS"] as? NSArray, [13, 0, 0])
43+
XCTAssertEqual(dictRep["PlatformVersion"] as? NSNumber, 2)
3444
}
3545

3646
func testThatMachineIdentifierIsParsedCorrectly() throws {
37-
XCTAssert(
38-
try configFileSample1.machineIdentifier.dataRepresentation,
39-
hasHash: "0DXW7UIFta6W86ZZd24QUy4Gx3EX1+r9i+yYk7xHi0s="
40-
)
47+
let dataRep = try configFileSample1.machineIdentifier.dataRepresentation
48+
// The `dataRepresentation` is supposed to be an opaque value / implementation detail,
49+
// but that's the only property we have access to and we can thus use for testing correct parsing.
50+
//
51+
// This `dataRepresentation` happens to be a binary plist representation of a NSDictionary.
52+
// We can't just compare the `dataRepresentation` directly with a fixed value though, because different
53+
// versions of macOS might serialize the exact same NSDictionary as a slightly different NSData representation.
54+
// Besides, future macOS versions might add additional keys in that internal representation of those objects.
55+
//
56+
// So the best we can do is check that the `dataRepresentation` is not nil and check some keys in that dict.
57+
// This is a bit fragile but at least it's more resilient than comparing the `dataRepresentation` directly.
58+
let dictRep = try XCTUnwrap(PropertyListSerialization.propertyList(from: dataRep, format: nil) as? NSDictionary)
59+
XCTAssertNotNil(dictRep["ECID"])
4160
}
4261

4362
func testThatMacAddressIsParsedCorrectly() throws {

0 commit comments

Comments
 (0)