diff --git a/Tests/Api/ObjectStoreTests.cs b/Tests/Api/ObjectStoreTests.cs index a0aabf35632b..34246efcf651 100644 --- a/Tests/Api/ObjectStoreTests.cs +++ b/Tests/Api/ObjectStoreTests.cs @@ -23,11 +23,41 @@ 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) + { + var fullKey = _ciTestFolder + key; + if (!ApiClient.GetObjectStoreProperties(TestOrganization, fullKey).Success) + { + ApiClient.SetObjectStore(TestOrganization, fullKey, _data); + } + } + } + [TestCaseSource(nameof(GetObjectStoreWorksAsExpectedTestCases))] public void GetObjectStoreWorksAsExpected(string testName, List keys, bool isSuccessExpected) { @@ -45,12 +75,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 +151,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} }; }