diff --git a/app/Models/Test.php b/app/Models/Test.php index 5d14599de6..15ece85bbe 100644 --- a/app/Models/Test.php +++ b/app/Models/Test.php @@ -5,7 +5,6 @@ use App\Enums\TestTimeStatusCategory; use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; @@ -19,7 +18,6 @@ * * @property int $id * @property int $buildid - * @property int $outputid * @property string $status 'failed' | 'passed' | 'notrun' TODO: Turn this into a proper enum. * @property float $time * @property float $timemean @@ -30,6 +28,9 @@ * @property string $testname * @property ?Carbon $starttime * @property TestTimeStatusCategory $timestatuscategory + * @property string $path + * @property string $command + * @property string $output * * @mixin Builder */ @@ -37,7 +38,7 @@ class Test extends Model { public $timestamps = false; - protected $table = 'build2test'; + protected $table = 'tests'; /** * @deprecated 08/24/2024 This member variable is deprecated. Use the labels() Eloquent relationship instead. @@ -58,7 +59,6 @@ class Test extends Model protected $fillable = [ 'buildid', - 'outputid', 'status', 'time', 'timemean', @@ -68,12 +68,14 @@ class Test extends Model 'details', 'testname', 'starttime', + 'path', + 'command', + 'output', ]; protected $casts = [ 'id' => 'integer', 'buildid' => 'integer', - 'outputid' => 'integer', 'time' => 'float', 'timemean' => 'float', 'timestd' => 'float', @@ -91,14 +93,6 @@ public function build(): BelongsTo return $this->belongsTo('App\Models\Build', 'buildid'); } - /** - * @return BelongsTo - */ - public function testOutput(): BelongsTo - { - return $this->belongsTo('App\Models\TestOutput', 'outputid'); - } - /** * @return HasMany */ @@ -131,36 +125,6 @@ public function testImages(): HasMany return $this->hasMany(TestImage::class, 'testid'); } - /** - * @return Attribute - */ - protected function path(): Attribute - { - return Attribute::make( - get: fn (mixed $value, array $attributes): ?string => $this->testOutput->path ?? null, - ); - } - - /** - * @return Attribute - */ - protected function command(): Attribute - { - return Attribute::make( - get: fn (mixed $value, array $attributes): ?string => $this->testOutput->command ?? null, - ); - } - - /** - * @return Attribute - */ - protected function output(): Attribute - { - return Attribute::make( - get: fn (mixed $value, array $attributes): ?string => $this->testOutput->output ?? null, - ); - } - /** * Add a label to this buildtest. * diff --git a/app/Models/TestOutput.php b/app/Models/TestOutput.php deleted file mode 100644 index 2ae020c5ba..0000000000 --- a/app/Models/TestOutput.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class TestOutput extends Model -{ - protected $table = 'testoutput'; - - public $timestamps = false; - - protected $fillable = [ - 'path', - 'command', - 'output', - ]; - - protected $casts = [ - 'id' => 'integer', - ]; - - /** - * @return HasMany - */ - public function tests(): HasMany - { - return $this->hasMany(Test::class, 'outputid'); - } -} diff --git a/app/Utils/TestCreator.php b/app/Utils/TestCreator.php index cc059ae56b..9680a66ce7 100755 --- a/app/Utils/TestCreator.php +++ b/app/Utils/TestCreator.php @@ -21,7 +21,6 @@ use App\Models\Test; use App\Models\TestImage; use App\Models\TestMeasurement; -use App\Models\TestOutput; use Carbon\Carbon; use CDash\Model\Build; use CDash\Model\Image; @@ -140,23 +139,19 @@ public function create(Build $build): void } DB::transaction(function () use ($build): void { - $outputid = TestOutput::select('id')->firstOrCreate([ - 'path' => $this->testPath, - 'command' => $this->testCommand, - 'output' => $this->testOutput, - ])->id; - // Note: the newstatus column is currently handled in // ctestparserutils::compute_test_difference. This gets updated when we call // Build::ComputeTestTiming. $buildtest = Test::create([ 'buildid' => $build->Id, - 'outputid' => $outputid, 'status' => $this->testStatus, 'details' => $this->testDetails, 'time' => "$this->buildTestTime", 'testname' => $this->testName, 'starttime' => $this->testStartTime, + 'path' => $this->testPath, + 'command' => $this->testCommand, + 'output' => $this->testOutput, ]); if ($this->measurements->isNotEmpty()) { diff --git a/app/cdash/tests/test_bazeljson.php b/app/cdash/tests/test_bazeljson.php index 475a1b41d0..2804692e57 100644 --- a/app/cdash/tests/test_bazeljson.php +++ b/app/cdash/tests/test_bazeljson.php @@ -62,7 +62,7 @@ public function testBazelJSON() $buildtestid = $test_stmt->fetchColumn(); // Verify that only output for the specified test is displayed - $output = Test::findOrFail((int) $buildtestid)->testOutput->output; + $output = Test::findOrFail((int) $buildtestid)->output; $not_expected = 'Executed 2 out of 2 tests'; if (str_contains($output, $not_expected)) { @@ -235,7 +235,7 @@ public function testBazelTestFailed() $buildtestid = $test_stmt->fetchColumn(); // Verify that all of the build output is displayed. - $output = Test::findOrFail((int) $buildtestid)->testOutput->output; + $output = Test::findOrFail((int) $buildtestid)->output; $expected = 'FAIL: testDrakeFindResourceOrThrowInInstall (__main__.TestCommonInstall)'; if (!str_contains($output, $expected)) { @@ -288,7 +288,7 @@ public function testBazelTimeout() $buildtestid = $test_stmt->fetchColumn(); // Verify that the 'TIMEOUT' message is displayed - $output = Test::findOrFail((int) $buildtestid)->testOutput->output; + $output = Test::findOrFail((int) $buildtestid)->output; $expected = 'TIMEOUT'; if (!str_contains($output, $expected)) { @@ -511,7 +511,7 @@ public function testShardTestFailures() $buildtestid = $test_stmt->fetchColumn(); // Verify that the expected output is displayed - $output = Test::findOrFail((int) $buildtestid)->testOutput->output; + $output = Test::findOrFail((int) $buildtestid)->output; $expected = '//automotive/maliput/multilane:multilane_builder_test'; if (!str_contains($output, $expected)) { @@ -540,7 +540,7 @@ public function testShardTestFailures() // Verify that the expected output is displayed $test = Test::findOrFail((int) $buildtestid); - $output = $test->testOutput->output; + $output = $test->output; $expected = 'automotive/maliput/multilane:multilane_lanes_test'; if (!str_contains($output, $expected)) { @@ -600,7 +600,7 @@ public function testShardTestTimeout() // Verify that the expected output is displayed $test = Test::findOrFail((int) $buildtestid); - $output = $test->testOutput->output; + $output = $test->output; $expected = 'Note: This is test shard 8 of 10.'; if (!str_contains($output, $expected)) { diff --git a/app/cdash/tests/test_outputcolor.php b/app/cdash/tests/test_outputcolor.php index d908fe1c86..ea4ba64827 100644 --- a/app/cdash/tests/test_outputcolor.php +++ b/app/cdash/tests/test_outputcolor.php @@ -47,7 +47,7 @@ public function testOutputColor(): void // Get test output. $buildtestid = $this->getIdForTest('colortest_long'); - $output = Test::findOrFail((int) $buildtestid)->testOutput->output; + $output = Test::findOrFail((int) $buildtestid)->output; // Check for expected escape sequences. if (!str_contains($output, "\x1B[32m")) { diff --git a/app/cdash/tests/test_redundanttests.php b/app/cdash/tests/test_redundanttests.php index 602205e14a..af75a66feb 100644 --- a/app/cdash/tests/test_redundanttests.php +++ b/app/cdash/tests/test_redundanttests.php @@ -66,7 +66,7 @@ public function testRedundantTests(): void $test1found = false; $test2found = false; foreach ($results as $row) { - $output = Test::findOrFail((int) $row->id)->testOutput?->output; + $output = Test::findOrFail((int) $row->id)->output; if ($output === "this is a test\n") { $test1found = true; } diff --git a/app/cdash/tests/test_truncateoutput.php b/app/cdash/tests/test_truncateoutput.php index fa37a8a465..01edae8f61 100644 --- a/app/cdash/tests/test_truncateoutput.php +++ b/app/cdash/tests/test_truncateoutput.php @@ -47,7 +47,7 @@ public function testTruncateOutput(): void build2test.testname = 'curl'"); $buildtestid = $buildtests[0]->id; - $testOutput = Test::findOrFail((int) $buildtestid)->testOutput->output; + $testOutput = Test::findOrFail((int) $buildtestid)->output; $expected = 'The rest of the test output was removed since it exceeds the threshold'; $this->assertTrue(str_contains($testOutput, $expected)); diff --git a/database/migrations/2026_09_17_172130_test_view.php b/database/migrations/2026_09_17_172130_test_view.php new file mode 100644 index 0000000000..6158001d28 --- /dev/null +++ b/database/migrations/2026_09_17_172130_test_view.php @@ -0,0 +1,214 @@ + v_outputid THEN + DELETE FROM testoutput + WHERE id = v_old_outputid + AND NOT EXISTS (SELECT 1 FROM build2test WHERE outputid = v_old_outputid); + END IF; + + ELSE + UPDATE build2test SET + buildid = COALESCE(NEW.buildid, 0), + status = NEW.status, + time = COALESCE(NEW.time, 0), + timemean = COALESCE(NEW.timemean, 0), + timestd = COALESCE(NEW.timestd, 0), + timestatus = COALESCE(NEW.timestatus, 0::smallint), + newstatus = COALESCE(NEW.newstatus, 0::smallint), + details = COALESCE(NEW.details, ''), + testname = NEW.testname, + starttime = NEW.starttime + WHERE id = OLD.id + RETURNING timestatuscategory INTO NEW.timestatuscategory; + END IF; + + NEW.path := v_path; + NEW.command := v_command; + NEW.output := v_output; + + RETURN NEW; + + ELSIF TG_OP = 'DELETE' THEN + DELETE FROM build2test WHERE id = OLD.id; + RETURN OLD; + END IF; + + RETURN NULL; + END; + $$ LANGUAGE plpgsql; + SQL); + + DB::unprepared(<<<'SQL' + CREATE TRIGGER tests_trigger + INSTEAD OF INSERT OR UPDATE OR DELETE ON tests + FOR EACH ROW + EXECUTE FUNCTION tests_view_trigger(); + SQL); + } + + public function down(): void + { + } +}; diff --git a/graphql/schema.graphql b/graphql/schema.graphql index 1eab0ea949..5c6bf41174 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -966,11 +966,11 @@ type Test { details: String! @filterable - path: String @with(relation: "testOutput") + path: String - command: String @with(relation: "testOutput") + command: String - output: String @with(relation: "testOutput") + output: String build: Build! @belongsTo diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1b109c351d..ce6298441a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -15966,11 +15966,6 @@ parameters: count: 1 path: app/cdash/tests/test_bazeljson.php - - - rawMessage: Cannot access property $output on App\Models\TestOutput|null. - identifier: property.nonObject - count: 6 - path: app/cdash/tests/test_bazeljson.php - rawMessage: 'Loose comparison via "!=" between int<0, max>|false and false is not allowed.' @@ -20169,11 +20164,6 @@ parameters: count: 3 path: app/cdash/tests/test_outputcolor.php - - - rawMessage: Cannot access property $output on App\Models\TestOutput|null. - identifier: property.nonObject - count: 1 - path: app/cdash/tests/test_outputcolor.php - rawMessage: 'Method OutputColorTestCase::getIdForTest() has no return type specified.' @@ -21702,11 +21692,6 @@ parameters: count: 2 path: app/cdash/tests/test_truncateoutput.php - - - rawMessage: Cannot access property $output on App\Models\TestOutput|null. - identifier: property.nonObject - count: 1 - path: app/cdash/tests/test_truncateoutput.php - rawMessage: Property TruncateOutputTestCase::$BuildId has no type specified. diff --git a/tests/Browser/Pages/BuildTestsPageTest.php b/tests/Browser/Pages/BuildTestsPageTest.php index 3f4c009246..f02824f330 100644 --- a/tests/Browser/Pages/BuildTestsPageTest.php +++ b/tests/Browser/Pages/BuildTestsPageTest.php @@ -8,7 +8,6 @@ use App\Models\SiteInformation; use App\Models\SubProject; use App\Models\Test; -use App\Models\TestOutput; use App\Services\SiteService; use Illuminate\Support\Str; use Laravel\Dusk\Browser; @@ -21,8 +20,6 @@ class BuildTestsPageTest extends BrowserTestCase private Project $project; - private TestOutput $testOutput; - private Site $site; public function setUp(): void @@ -31,12 +28,6 @@ public function setUp(): void $this->project = $this->makePublicProject(); - $this->testOutput = TestOutput::create([ - 'path' => 'a', - 'command' => 'b', - 'output' => 'c', - ]); - $this->site = Site::factory()->create(); SiteService::updateSiteInfoIfChanged($this->site, new SiteInformation([])); } @@ -44,7 +35,6 @@ public function setUp(): void public function tearDown(): void { $this->project->delete(); - $this->testOutput->delete(); $this->site->delete(); parent::tearDown(); @@ -92,7 +82,6 @@ public function testFiltersByParentAndChildBuildTests(): void $parent_build_test = $parent_build->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $child_build_1_test */ @@ -105,7 +94,6 @@ public function testFiltersByParentAndChildBuildTests(): void ])->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $child_build_2_test */ @@ -118,7 +106,6 @@ public function testFiltersByParentAndChildBuildTests(): void ])->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'passed', - 'outputid' => $this->testOutput->id, ]); $this->browse(function (Browser $browser) use ($parent_build_test, $child_build_2_test, $child_build_1_test, $parent_build): void { @@ -165,7 +152,6 @@ public function testHidesSubProjectColumnWhenNoChildBuilds(): void $test = $build->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); $this->browse(function (Browser $browser) use ($test, $build): void { @@ -202,7 +188,6 @@ public function testShowsSubProjectColumnWhenHasChildBuilds(): void ])->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); $this->browse(function (Browser $browser) use ($child_build_test, $parent_build): void { @@ -232,7 +217,6 @@ public function testConfigurableTimeStatusColumn(): void 'testname' => Str::uuid()->toString(), 'status' => 'passed', 'timestatus' => 5, - 'outputid' => $this->testOutput->id, ]); // Check that the time status column is hidden when not configured to show it @@ -285,7 +269,6 @@ public function testHistoryColumn(): void $test = $build->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); $this->browse(function (Browser $browser) use ($test, $build): void { @@ -319,7 +302,6 @@ public function testMeasurementColumns(): void $test = $build->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); $measurement1 = $test->testMeasurements()->create([ @@ -399,28 +381,24 @@ public function testOnlyDelta(): void $previous_test_failed = $previous_build->tests()->create([ 'testname' => 'failed-before', 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $previous_test_passed */ $previous_test_passed = $previous_build->tests()->create([ 'testname' => 'passed-before', 'status' => 'passed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $previous_test_to_be_fixed */ $previous_test_to_be_fixed = $previous_build->tests()->create([ 'testname' => 'fixed-test', 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $previous_test_stayed_passed */ $previous_test_stayed_passed = $previous_build->tests()->create([ 'testname' => 'stayed-passed', 'status' => 'passed', - 'outputid' => $this->testOutput->id, ]); /** @var Build $current_build */ @@ -436,35 +414,30 @@ public function testOnlyDelta(): void $current_test_failed_again = $current_build->tests()->create([ 'testname' => 'failed-before', 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $current_test_newly_failed */ $current_test_newly_failed = $current_build->tests()->create([ 'testname' => 'passed-before', 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $current_test_entirely_new_failed */ $current_test_entirely_new_failed = $current_build->tests()->create([ 'testname' => 'new-failed', 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $current_test_fixed */ $current_test_fixed = $current_build->tests()->create([ 'testname' => 'fixed-test', 'status' => 'passed', - 'outputid' => $this->testOutput->id, ]); /** @var Test $current_test_stayed_passed */ $current_test_stayed_passed = $current_build->tests()->create([ 'testname' => 'stayed-passed', 'status' => 'passed', - 'outputid' => $this->testOutput->id, ]); $this->browse(function (Browser $browser) use ($current_build, $current_test_failed_again, $current_test_newly_failed, $current_test_entirely_new_failed, $current_test_fixed, $current_test_stayed_passed): void { @@ -494,7 +467,6 @@ public function testOnlyDeltaNoResults(): void $previous_test_failed = $previous_build->tests()->create([ 'testname' => 'failed-before', 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); /** @var Build $current_build */ @@ -510,7 +482,6 @@ public function testOnlyDeltaNoResults(): void $current_test_failed_again = $current_build->tests()->create([ 'testname' => 'failed-before', 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); $this->browse(function (Browser $browser) use ($current_build): void { diff --git a/tests/Browser/Pages/TestsIdPageTest.php b/tests/Browser/Pages/TestsIdPageTest.php index 28836d796d..d0216c3807 100644 --- a/tests/Browser/Pages/TestsIdPageTest.php +++ b/tests/Browser/Pages/TestsIdPageTest.php @@ -9,7 +9,6 @@ use App\Models\Site; use App\Models\SiteInformation; use App\Models\Test; -use App\Models\TestOutput; use App\Services\SiteService; use Illuminate\Support\Carbon; use Illuminate\Support\Str; @@ -57,14 +56,10 @@ public function tearDown(): void */ private function createTest(array $attributes = []): Test { - $output = TestOutput::create([ + $attributes = array_merge([ 'path' => (string) Str::uuid(), 'command' => (string) Str::uuid(), 'output' => '', - ]); - - $attributes = array_merge([ - 'outputid' => $output->id, 'timemean' => 0, 'timestd' => 0, ], $attributes); @@ -416,18 +411,16 @@ public function testOutputCardAlwaysPresent(): void }); // Add output - $testOutput = TestOutput::create([ - 'path' => (string) Str::uuid(), - 'command' => (string) Str::uuid(), - 'output' => (string) Str::uuid(), - ]); - $test->outputid = $testOutput->id; + $outputText = (string) Str::uuid(); + $test->path = (string) Str::uuid(); + $test->command = (string) Str::uuid(); + $test->output = $outputText; $test->save(); - $this->browse(function (Browser $browser) use ($test, $testOutput): void { + $this->browse(function (Browser $browser) use ($test, $outputText): void { $browser->visit("/tests/{$test->id}") - ->waitForText($testOutput->output) - ->assertSee($testOutput->output) + ->waitForText($outputText) + ->assertSee($outputText) ->assertMissing('@no-output-message'); }); } diff --git a/tests/Feature/GraphQL/FilterTest.php b/tests/Feature/GraphQL/FilterTest.php index 9e0e53ab76..c85ef198e4 100644 --- a/tests/Feature/GraphQL/FilterTest.php +++ b/tests/Feature/GraphQL/FilterTest.php @@ -7,7 +7,6 @@ use App\Models\Site; use App\Models\Target; use App\Models\Test; -use App\Models\TestOutput; use App\Models\User; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\DB; @@ -36,8 +35,6 @@ class FilterTest extends TestCase */ private array $sites = []; - private TestOutput $testOutput; - protected function setUp(): void { parent::setUp(); @@ -56,12 +53,6 @@ protected function setUp(): void 'normal' => User::factory()->create(), 'admin' => User::factory()->adminUser()->create(), ]; - - $this->testOutput = TestOutput::create([ - 'path' => 'a', - 'command' => 'b', - 'output' => 'c', - ]); } protected function tearDown(): void @@ -81,8 +72,6 @@ protected function tearDown(): void } $this->sites = []; - $this->testOutput->delete(); - parent::tearDown(); } @@ -1092,7 +1081,6 @@ public function testFilterNonPaginatedList(): void $test = $build->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'passed', - 'outputid' => $this->testOutput->id, ]); $measurement1 = $test->testMeasurements()->create([ diff --git a/tests/Feature/GraphQL/ProjectTypeTest.php b/tests/Feature/GraphQL/ProjectTypeTest.php index e5719bd30f..43e4681b6a 100644 --- a/tests/Feature/GraphQL/ProjectTypeTest.php +++ b/tests/Feature/GraphQL/ProjectTypeTest.php @@ -4,7 +4,6 @@ use App\Enums\ProjectRole; use App\Models\Project; -use App\Models\TestOutput; use App\Models\User; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Str; @@ -1272,12 +1271,6 @@ public function testBuildCountFieldWithFilters(): void public function testTestsRelationship(): void { - $output = TestOutput::create([ - 'path' => 'a', - 'command' => 'b', - 'output' => 'c', - ]); - // First build with two tests. $this->projects['public1']->builds()->create([ 'name' => 'build1', @@ -1286,12 +1279,10 @@ public function testTestsRelationship(): void [ 'testname' => 'test1', 'status' => 'passed', - 'outputid' => $output->id, ], [ 'testname' => 'test2', 'status' => 'failed', - 'outputid' => $output->id, ], ]); @@ -1302,7 +1293,6 @@ public function testTestsRelationship(): void ])->tests()->create([ 'testname' => 'test3', 'status' => 'notrun', - 'outputid' => $output->id, ]); // A test belonging to a different project should not be returned. @@ -1312,7 +1302,6 @@ public function testTestsRelationship(): void ])->tests()->create([ 'testname' => 'test4', 'status' => 'passed', - 'outputid' => $output->id, ]); $this->graphQL(' @@ -1358,8 +1347,6 @@ public function testTestsRelationship(): void ], ], ]); - - $output->delete(); } /** @@ -1398,12 +1385,6 @@ public function testTestsRelationshipEmpty(): void */ public function testTestsRelationshipWithFilters(): void { - $output = TestOutput::create([ - 'path' => 'a', - 'command' => 'b', - 'output' => 'c', - ]); - $this->projects['public1']->builds()->create([ 'name' => 'build1', 'uuid' => Str::uuid(), @@ -1411,12 +1392,10 @@ public function testTestsRelationshipWithFilters(): void [ 'testname' => 'passing_test', 'status' => 'passed', - 'outputid' => $output->id, ], [ 'testname' => 'failing_test', 'status' => 'failed', - 'outputid' => $output->id, ], ]); @@ -1451,7 +1430,5 @@ public function testTestsRelationshipWithFilters(): void ], ], ]); - - $output->delete(); } } diff --git a/tests/Feature/GraphQL/QueryTypeTest.php b/tests/Feature/GraphQL/QueryTypeTest.php index d208c18b24..478f457b37 100644 --- a/tests/Feature/GraphQL/QueryTypeTest.php +++ b/tests/Feature/GraphQL/QueryTypeTest.php @@ -9,7 +9,6 @@ use App\Models\DynamicAnalysis; use App\Models\Project; use App\Models\Test; -use App\Models\TestOutput; use App\Models\User; use Exception; use Illuminate\Foundation\Testing\DatabaseTransactions; @@ -393,12 +392,6 @@ public function testTestFieldRestrictsAccessByProject(): void $user = User::factory()->create(); $this->users[] = $user; - $testOutput = TestOutput::create([ - 'path' => Str::uuid()->toString(), - 'command' => Str::uuid()->toString(), - 'output' => Str::uuid()->toString(), - ]); - $project1 = $this->makePrivateProject(); $project1->users() ->attach($user->id, [ @@ -411,7 +404,6 @@ public function testTestFieldRestrictsAccessByProject(): void ])->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $testOutput->id, ]); $project2 = $this->makePrivateProject(); @@ -422,7 +414,6 @@ public function testTestFieldRestrictsAccessByProject(): void ])->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $testOutput->id, ]); $this->actingAs($user)->graphQL(' diff --git a/tests/Feature/GraphQL/TestImageTypeTest.php b/tests/Feature/GraphQL/TestImageTypeTest.php index 2e79a6e88e..228716bb76 100644 --- a/tests/Feature/GraphQL/TestImageTypeTest.php +++ b/tests/Feature/GraphQL/TestImageTypeTest.php @@ -4,7 +4,6 @@ use App\Models\Image; use App\Models\Project; -use App\Models\TestOutput; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Str; use Random\RandomException; @@ -19,7 +18,6 @@ class TestImageTypeTest extends TestCase private Project $project; private Image $image; - private TestOutput $testOutput; /** * @throws RandomException @@ -35,12 +33,6 @@ protected function setUp(): void 'extension' => '.png', 'checksum' => '123', ]); - - $this->testOutput = TestOutput::create([ - 'path' => Str::uuid()->toString(), - 'command' => Str::uuid()->toString(), - 'output' => Str::uuid()->toString(), - ]); } /** @@ -54,7 +46,6 @@ public function testBasicFieldAccess(): void ])->tests()->create([ 'testname' => Str::uuid()->toString(), 'status' => 'failed', - 'outputid' => $this->testOutput->id, ]); $testImageNoImage = $test->testImages()->create([ diff --git a/tests/Feature/GraphQL/TestMeasurementTypeTest.php b/tests/Feature/GraphQL/TestMeasurementTypeTest.php index b06242e01d..b2b015c9a5 100644 --- a/tests/Feature/GraphQL/TestMeasurementTypeTest.php +++ b/tests/Feature/GraphQL/TestMeasurementTypeTest.php @@ -3,7 +3,6 @@ namespace Tests\Feature\GraphQL; use App\Models\Project; -use App\Models\TestOutput; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Str; use Random\RandomException; @@ -17,7 +16,6 @@ class TestMeasurementTypeTest extends TestCase use DatabaseTransactions; private Project $project; - private TestOutput $test_output; /** * @throws RandomException @@ -27,13 +25,6 @@ protected function setUp(): void parent::setUp(); $this->project = $this->makePublicProject(); - - // A common test output to share among all of our tests - $this->test_output = TestOutput::create([ - 'path' => 'a', - 'command' => 'b', - 'output' => 'c', - ]); } protected function tearDown(): void @@ -41,8 +32,6 @@ protected function tearDown(): void // Deleting the project will delete all corresponding builds and tests $this->project->delete(); - $this->test_output->delete(); - parent::tearDown(); } @@ -57,7 +46,6 @@ public function testBasicFieldAccess(): void ])->tests()->create([ 'testname' => 'test1', 'status' => 'failed', - 'outputid' => $this->test_output->id, ])->testMeasurements()->createMany([ [ 'name' => 'measurement 1', diff --git a/tests/Feature/GraphQL/TestTypeTest.php b/tests/Feature/GraphQL/TestTypeTest.php index e6892d69ff..829b070244 100644 --- a/tests/Feature/GraphQL/TestTypeTest.php +++ b/tests/Feature/GraphQL/TestTypeTest.php @@ -5,7 +5,6 @@ use App\Models\Label; use App\Models\Project; use App\Models\Test; -use App\Models\TestOutput; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Str; use PHPUnit\Framework\Attributes\DataProvider; @@ -20,7 +19,6 @@ class TestTypeTest extends TestCase use DatabaseTransactions; private Project $project; - private TestOutput $test_output; /** * @throws RandomException @@ -30,13 +28,6 @@ protected function setUp(): void parent::setUp(); $this->project = $this->makePublicProject(); - - // A common test output to share among all of our tests - $this->test_output = TestOutput::create([ - 'path' => 'a', - 'command' => 'b', - 'output' => 'c', - ]); } protected function tearDown(): void @@ -44,8 +35,6 @@ protected function tearDown(): void // Deleting the project will delete all corresponding builds and tests $this->project->delete(); - $this->test_output->delete(); - parent::tearDown(); } @@ -64,7 +53,9 @@ public function testBasicFieldAccess(): void 'time' => 1.2, 'timemean' => 3.4, 'timestd' => 5.6, - 'outputid' => $this->test_output->id, + 'path' => 'a', + 'command' => 'b', + 'output' => 'c', 'starttime' => '2026-02-13T18:03:54+00:00', ]); @@ -143,7 +134,6 @@ public function testBuildRelationship(): void $build->tests()->create([ 'testname' => 'test1', 'status' => 'passed', - 'outputid' => $this->test_output->id, ]); $this->graphQL(' @@ -206,7 +196,6 @@ public function testStatusEnum(string $db_value, string $enum_value): void ])->tests()->create([ 'testname' => 'test1', 'status' => $db_value, - 'outputid' => $this->test_output->id, ]); $this->graphQL(' @@ -280,7 +269,6 @@ public function testTimeStatusCategoryEnum(int $timestatus_db_value, string $enu 'testname' => 'test1', 'status' => 'passed', 'timestatus' => $timestatus_db_value, - 'outputid' => $this->test_output->id, ]); $this->graphQL(' @@ -341,7 +329,6 @@ public function testLabelRelationship(): void $label = $build->tests()->create([ 'testname' => Str::uuid()->toString(), - 'outputid' => $this->test_output->id, 'status' => 'passed', ])->labels()->save(Label::factory()->make()); @@ -403,7 +390,6 @@ public function testLabelFilters(): void $test = $build->tests()->create([ 'testname' => Str::uuid()->toString(), - 'outputid' => $this->test_output->id, 'status' => 'passed', ]);