From 76d3e63e58b16f121d714c4dfec516e320e32777 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Mon, 20 Apr 2026 13:40:41 -0500 Subject: [PATCH 1/2] Fix object store CI tests by uploading required files in test setup --- Tests/Api/ObjectStoreTests.cs | 70 +++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/Tests/Api/ObjectStoreTests.cs b/Tests/Api/ObjectStoreTests.cs index a0aabf35632b..9551a5ec941f 100644 --- a/Tests/Api/ObjectStoreTests.cs +++ b/Tests/Api/ObjectStoreTests.cs @@ -23,11 +23,43 @@ namespace QuantConnect.Tests.API { [TestFixture, Explicit("Requires configured api access and available backtest node to run on"), Parallelizable(ParallelScope.Fixtures)] - public class ObjectStoreTests: ApiTestBase + public class ObjectStoreTests : ApiTestBase { - private const string _key = "/Ricardo"; + private const string _ciTestFolder = "/CI_TEST"; + private const string _key = _ciTestFolder + "/Ricardo"; private readonly byte[] _data = new byte[3] { 1, 2, 3 }; + private static readonly string[] _keysToSetUp = new[] + { + "/filename.zip", + "/mm_test.csv", + "/model", + "/trades_test.json", + "/profile_results.json", + "/CustomData/placeholder.txt", + "/log.txt", + "/l1_model.p", + "/latency_1_False.txt", + "/portfolio-targets2.csv", + "/Regressor", + "/example_data_2.zip" + }; + + [OneTimeSetUp] + public void SetUpObjectStoreFiles() + { + foreach (var key in _keysToSetUp) + { + ApiClient.SetObjectStore(TestOrganization, _ciTestFolder + key, _data); + } + } + + [OneTimeTearDown] + public void TearDownObjectStoreFiles() + { + ApiClient.DeleteObjectStore(TestOrganization, _ciTestFolder); + } + [TestCaseSource(nameof(GetObjectStoreWorksAsExpectedTestCases))] public void GetObjectStoreWorksAsExpected(string testName, List keys, bool isSuccessExpected) { @@ -45,12 +77,12 @@ public void GetObjectStoreWorksAsExpected(string testName, List keys, bo } } - [TestCase("/filename.zip", true)] - [TestCase("/orats_2024-02-32.json", false)] - [TestCase("/mrm8488", false)] - [TestCase("/mm_test.csv", true)] - [TestCase("/model", true)] - [TestCase("/trades_test.json", true)] + [TestCase(_ciTestFolder + "/filename.zip", true)] + [TestCase(_ciTestFolder + "/orats_2024-02-32.json", false)] + [TestCase(_ciTestFolder + "/mrm8488", false)] + [TestCase(_ciTestFolder + "/mm_test.csv", true)] + [TestCase(_ciTestFolder + "/model", true)] + [TestCase(_ciTestFolder + "/trades_test.json", true)] public void GetObjectStorePropertiesWorksAsExpected(string key, bool isSuccessExpected) { var result = ApiClient.GetObjectStoreProperties(TestOrganization, key); @@ -121,19 +153,19 @@ public void ListObjectStoreWorksAsExpected() private static object[] GetObjectStoreWorksAsExpectedTestCases = { - new object[] { "Two keys present", new List { "/trades_test.json", "/profile_results.json" }, true}, + new object[] { "Two keys present", new List { _ciTestFolder + "/trades_test.json", _ciTestFolder + "/profile_results.json" }, true}, new object[] { "No key is given", new List {}, false}, - new object[] { "One key is present and the other one not", new List { "/trades_test.json", "/orats_2024-02-32.json" }, true}, - new object[] { "The key is not present", new List { "/orats_2024-02-32.json" }, false}, - new object[] { "The type of the object store file is directory", new List { "/CustomData" }, true}, - new object[] { "The type of the object store file is text/plain", new List { "/log.txt" }, true}, - new object[] { "The type of the object store file is application/octet-stream", new List { "/model" }, true}, - new object[] { "The type of the object store file is P", new List { "/l1_model.p" }, true}, + new object[] { "One key is present and the other one not", new List { _ciTestFolder + "/trades_test.json", _ciTestFolder + "/orats_2024-02-32.json" }, true}, + new object[] { "The key is not present", new List { _ciTestFolder + "/orats_2024-02-32.json" }, false}, + new object[] { "The type of the object store file is directory", new List { _ciTestFolder + "/CustomData" }, true}, + new object[] { "The type of the object store file is text/plain", new List { _ciTestFolder + "/log.txt" }, true}, + new object[] { "The type of the object store file is application/octet-stream", new List { _ciTestFolder + "/model" }, true}, + new object[] { "The type of the object store file is P", new List { _ciTestFolder + "/l1_model.p" }, true}, new object[] { "Heavy object store files", new List { - "/latency_1_False.txt", - "/portfolio-targets2.csv", - "/Regressor", - "/example_data_2.zip" + _ciTestFolder + "/latency_1_False.txt", + _ciTestFolder + "/portfolio-targets2.csv", + _ciTestFolder + "/Regressor", + _ciTestFolder + "/example_data_2.zip" }, true} }; } From 4f2036148bdb1703d8d7841263a96c0d2b5cbe2b Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Mon, 20 Apr 2026 15:27:38 -0500 Subject: [PATCH 2/2] Address review comments --- Tests/Api/ObjectStoreTests.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Tests/Api/ObjectStoreTests.cs b/Tests/Api/ObjectStoreTests.cs index 9551a5ec941f..34246efcf651 100644 --- a/Tests/Api/ObjectStoreTests.cs +++ b/Tests/Api/ObjectStoreTests.cs @@ -50,16 +50,14 @@ public void SetUpObjectStoreFiles() { foreach (var key in _keysToSetUp) { - ApiClient.SetObjectStore(TestOrganization, _ciTestFolder + key, _data); + var fullKey = _ciTestFolder + key; + if (!ApiClient.GetObjectStoreProperties(TestOrganization, fullKey).Success) + { + ApiClient.SetObjectStore(TestOrganization, fullKey, _data); + } } } - [OneTimeTearDown] - public void TearDownObjectStoreFiles() - { - ApiClient.DeleteObjectStore(TestOrganization, _ciTestFolder); - } - [TestCaseSource(nameof(GetObjectStoreWorksAsExpectedTestCases))] public void GetObjectStoreWorksAsExpected(string testName, List keys, bool isSuccessExpected) {