Allows adding a storage 'realm' to the storage base URL (#131951)
Context: https://github.com/flutter/flutter/issues/131862 This PR injects a "realm" component to the storage base URL when the contents of the file `bin/internal/engine.realm` is non-empty. As documented in the PR, when the realm is `flutter_archives_v2`, and `bin/internal/engine.version` contains the commit hash for a commit in a `flutter/engine` PR, then the artifacts pulled by the tool will be the artifacts built by the presubmit checks for the PR. This works for everything but the following two cases: 1. Fuchsia artifacts are not uploaded to CIPD by the Fuchsia presubmit builds. 2. Web artifacts are not uploaded to gstatic by the web engine presubmit builds. For (1), the flutter/flutter presubmit `fuchsia_precache` is driven by a shell script outside of the repo. It will fail when the `engine.version` and `engine.realm` don't point to a post-submit engine commit. For (2), the flutter/flutter web presubmit tests that refer to artifacts in gstatic hang when the artifacts aren't found, so this PR skips them.
This commit is contained in:
@@ -334,6 +334,37 @@ void main() {
|
||||
expect(logger.warningText, contains('Flutter assets will be downloaded from $baseUrl'));
|
||||
expect(logger.statusText, isEmpty);
|
||||
});
|
||||
|
||||
testWithoutContext('a non-empty realm is included in the storage url', () async {
|
||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||
final Directory internalDir = fileSystem.currentDirectory
|
||||
.childDirectory('cache')
|
||||
.childDirectory('bin')
|
||||
.childDirectory('internal');
|
||||
final File engineVersionFile = internalDir.childFile('engine.version');
|
||||
engineVersionFile.createSync(recursive: true);
|
||||
engineVersionFile.writeAsStringSync('abcdef');
|
||||
|
||||
final File engineRealmFile = internalDir.childFile('engine.realm');
|
||||
engineRealmFile.createSync(recursive: true);
|
||||
engineRealmFile.writeAsStringSync('flutter_archives_v2');
|
||||
|
||||
final Cache cache = Cache.test(
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: fileSystem,
|
||||
);
|
||||
|
||||
expect(cache.storageBaseUrl, contains('flutter_archives_v2'));
|
||||
});
|
||||
|
||||
test('bin/internal/engine.realm is empty', () async {
|
||||
final FileSystem fileSystem = globals.fs;
|
||||
final String realmFilePath = fileSystem.path.join(
|
||||
getFlutterRoot(), 'bin', 'internal', 'engine.realm');
|
||||
final String realm = fileSystem.file(realmFilePath).readAsStringSync().trim();
|
||||
expect(realm, isEmpty,
|
||||
reason: 'The checked-in engine.realm file must be empty.');
|
||||
});
|
||||
});
|
||||
|
||||
testWithoutContext('flattenNameSubdirs', () {
|
||||
|
||||
Reference in New Issue
Block a user