Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@ryansg.com>2021-12-02 12:32:56 -0500
committerMike Gerwitz <mike.gerwitz@ryansg.com>2021-12-02 12:38:06 -0500
commitfd1b1527d6ec2236fbc4e63b27f7283aff8ad990 (patch)
treee4b1b4b6cba4ee6fc8b47cf3f11bada08b9e991f /tamer/tests/tameld.rs
parent87c457ba41a146400dd4ae9d141925d781ae37b1 (diff)
downloadtame-fd1b1527d6ec2236fbc4e63b27f7283aff8ad990.tar.gz
tame-fd1b1527d6ec2236fbc4e63b27f7283aff8ad990.tar.bz2
tame-fd1b1527d6ec2236fbc4e63b27f7283aff8ad990.zip
tamer: Remove tests invoking cargo and associated libs
There are a number of reasons for this, where the benefits do not make up for the losses. First: this is actually invoking cargo. Not only is this not necessary, but it's not desirable: cargo by default hits the network and does all sorts of other stuff, when all we want to do is invoke the executable. So the tests aren't really testing the right thing in that sense. See the previous commit for more information. The way it invokes cargo is different than the way the Makefile invokes cargo, so on my system, it's actually invoking a _different cargo_! This is causing problems, in particular with lock files, which causes my tests to fail. Importantly, this also removes a _lot_ of dependencies, which removes a lot of supplier chain risk and a lot of code to audit. This provides significant security benefits, especially given that what was being tested was rather small, and could be done in a shell script. TAMER will receive significant system testing later on. But for now, none of this was worth it. Further audits of dependencies will come later on. I've always been fairly insistent on keeping the dependency graph small and auditable, but recent supply chain attacks have given me a better way to rationalize the security risk. Further, I'm the only one on this project right now.
Diffstat (limited to 'tamer/tests/tameld.rs')
-rw-r--r--tamer/tests/tameld.rs105
1 files changed, 0 insertions, 105 deletions
diff --git a/tamer/tests/tameld.rs b/tamer/tests/tameld.rs
deleted file mode 100644
index 78a401a..0000000
--- a/tamer/tests/tameld.rs
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (C) 2014-2021 Ryan Specialty Group, LLC.
-//
-// This file is part of TAME.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-use assert_cmd::prelude::*;
-use predicates::prelude::*;
-use std::process::Command;
-
-#[test]
-fn link_invalid_argument() -> Result<(), Box<dyn std::error::Error>> {
- let mut cmd = Command::cargo_bin("tameld")?;
- cmd.arg("-q");
- cmd.assert()
- .failure()
- .code(exitcode::USAGE)
- .stderr(predicate::str::contains("Unrecognized option:"));
-
- Ok(())
-}
-
-#[test]
-fn link_missing_input_file() -> Result<(), Box<dyn std::error::Error>> {
- let mut cmd = Command::cargo_bin("tameld")?;
- cmd.assert()
- .failure()
- .code(exitcode::USAGE)
- .stderr(predicate::str::contains("FILE"));
-
- Ok(())
-}
-
-#[test]
-fn link_missing_output_file() -> Result<(), Box<dyn std::error::Error>> {
- let mut cmd = Command::cargo_bin("tameld")?;
- cmd.arg("foobar");
- cmd.assert()
- .failure()
- .code(exitcode::USAGE)
- .stderr(predicate::str::contains("-o OUTPUT"));
-
- Ok(())
-}
-
-#[test]
-fn link_input_file_does_not_exist() -> Result<(), Box<dyn std::error::Error>> {
- let mut cmd = Command::cargo_bin("tameld")?;
- cmd.arg("foobar");
- cmd.arg("-o").arg("tests/data/test-output.xmle");
- cmd.assert()
- .failure()
- .code(1)
- .stderr(predicate::str::contains("No such file or directory"));
-
- Ok(())
-}
-
-#[test]
-fn link_invalid_emit() -> Result<(), Box<dyn std::error::Error>> {
- let mut cmd = Command::cargo_bin("tameld")?;
- cmd.arg("foobar");
- cmd.arg("--emit").arg("notgood");
- cmd.arg("-o").arg("tests/data/test-output.xmle");
- cmd.assert()
- .failure()
- .stderr(predicate::str::contains("--emit notgood"));
-
- Ok(())
-}
-
-#[test]
-fn link_empty_input_file() -> Result<(), Box<dyn std::error::Error>> {
- let mut cmd = Command::cargo_bin("tameld")?;
- cmd.arg("tests/data/empty.xmlo");
- cmd.arg("-o").arg("tests/data/test-output.xmle");
- cmd.assert()
- .failure()
- .stderr(predicate::str::contains("stack overflow")); // uh oh
-
- Ok(())
-}
-
-#[test]
-fn link_invalid_input_file() -> Result<(), Box<dyn std::error::Error>> {
- let mut cmd = Command::cargo_bin("tameld")?;
- cmd.arg("tests/data/invalid.xmlo");
- cmd.arg("-o").arg("tests/data/test-output.xmle");
- cmd.assert()
- .failure()
- .stderr(predicate::str::contains("stack overflow")); // uh oh
-
- Ok(())
-}