From 68b05f63c9d15b2f97f02ef5866c208605746a7f Mon Sep 17 00:00:00 2001 From: Ethan Chiu Date: Wed, 8 Jul 2020 16:25:20 -0400 Subject: [PATCH] Add filetable to testing file, remove ? since we know filetable should never be non null --- src/Runner.Worker/ActionManifestManager.cs | 9 +++------ src/Test/L0/Worker/ActionRunnerL0.cs | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Runner.Worker/ActionManifestManager.cs b/src/Runner.Worker/ActionManifestManager.cs index 80a805035..ae5ca73d7 100644 --- a/src/Runner.Worker/ActionManifestManager.cs +++ b/src/Runner.Worker/ActionManifestManager.cs @@ -75,7 +75,7 @@ namespace GitHub.Runner.Worker // Add this file to the FileTable in executionContext if it hasn't been added already // we use > since fileID is 1 indexed - if (fileId > executionContext.FileTable?.Count) + if (fileId > executionContext.FileTable.Count) { executionContext.FileTable.Add(fileRelativePath); } @@ -298,12 +298,9 @@ namespace GitHub.Runner.Worker } // Add the file table from the Execution Context - if (executionContext.FileTable?.Count > 0) + for (var i = 0; i < executionContext.FileTable.Count; i++) { - for (var i = 0; i < executionContext.FileTable.Count; i++) - { - result.GetFileId(executionContext.FileTable[i]); - } + result.GetFileId(executionContext.FileTable[i]); } return result; diff --git a/src/Test/L0/Worker/ActionRunnerL0.cs b/src/Test/L0/Worker/ActionRunnerL0.cs index 662ea307d..1851f47d7 100644 --- a/src/Test/L0/Worker/ActionRunnerL0.cs +++ b/src/Test/L0/Worker/ActionRunnerL0.cs @@ -379,6 +379,7 @@ namespace GitHub.Runner.Common.Tests.Worker _ec.Setup(x => x.ExpressionFunctions).Returns(new List()); _ec.Setup(x => x.IntraActionState).Returns(new Dictionary()); _ec.Setup(x => x.EnvironmentVariables).Returns(new Dictionary()); + _ec.Setup(x => x.FileTable).Returns(new List()); _ec.Setup(x => x.SetGitHubContext(It.IsAny(), It.IsAny())); _ec.Setup(x => x.GetGitHubContext(It.IsAny())).Returns("{\"foo\":\"bar\"}"); _ec.Setup(x => x.CancellationToken).Returns(_ecTokenSource.Token);