Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

677 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentry Hive, Spark Framework of Automation Test: sentry-test

It's simple framework of automation test for sentry hive, spark.

This project was written in bash and java.

sentry-test does...

  • Allow you to run sentry, hive automated testing.
  • Allow you to run sentry, spark automated testing.
  • Allow you to run Single test case or All test cases.

Table of Contents


How It Works

  • sentry will grant user, role and group privileges
  • hive or spark will execute sql with authorized End-user

How To Run It

The command will run sentry hive, spark test cases. All test cases will be defined in the script. You can specify single test case or multiple test cases to run.

$ /usr/bin/time -f "Time: %U" bash sentry_dispatcher.sh

How To Run It Step By Step

You can also run it by manually.

  1. grant user with super privilege.
    super privilege will be granted to user mt_qa .

    $ source ./sentry-test/src/main/resources/sentry_super_env.sh setup SuperPrivil

    NOTE: Usage: sentry_super_env.sh (setup|clean|check) SuperPrivil

  2. grant user with normal privilege.
    You should specify the test name which need to be granted, if you need to run test case with ServerAll privilege.

    $ source ./sentry-test/src/main/resources/sentry_env.sh setup ServerAll

    NOTE: Usage: sentry_env.sh (setup|clean|check) ServerAll

  3. login hive shell with super user to execute prepare sql.
    To execute prepare sql, you need to login hive shell with super user (mt_qa).

    $ source ./sentry-test/src/main/resources/hive_env.sh proxy_user_t1 super
    $ /opt/meituan/hive-1.2/bin/hive --hiveconf hive.cli.errors.ignore=true -f ./sentry-test/src/test/resources/hive-sql/common-sql/prepareAll.sql

    NOTE: Usage: hive_env.sh (keytab_auth|proxy_user_t1|proxy_user_t2_1|proxy_user_t2_2|proxy_user_group1|proxy_user_group2|clean_proxy_user) (super|normal|hive)"

  4. login hive shell with normal user and run single test case.
    You can now login hive shell with normal user and run specify test case. For example: ServerAll

    $ source sentry-test/src/main/resources/hive_env.sh proxy_user_t1 normal
    $ java -Djava.ext.dirs=./sentry-test/test-lib/ -cp ./sentry-test/target/classes:./sentry-test/target/test-classes/ org.junit.runner.JUnitCore ServerAll
  5. login hive shell with super user to execute post sql.
    To execute post sql, you need to login hive shell with super user (mt_qa).

    $ source ./sentry-test/src/main/resources/hive_env.sh proxy_user_t1 super
    $ /opt/meituan/hive-1.2/bin/hive --hiveconf hive.cli.errors.ignore=true -f ./sentry-test/src/test/resources/hive-sql/common-sql/post.sql
  6. clean proxy env.
    You need to clean proxy env, if you login hive with proxy approach.

    $ source ./sentry-test/src/main/resources/hive_env.sh clean_proxy_user hive

    NOTE: login hive with proxy approach, we need to unset proxy env otherwise it will throw exception.
    NOTE: login hive with keytab approach, this step is not needed.

  7. revoke user with super privilege.
    super privilege will be revoked to user mt_qa.

    $ source ./sentry-test/src/main/resources/sentry_super_env.sh clean SuperPrivil
  8. revoke user with normal privilege.
    You should specify the test name which need to be revoked, if you need to revoke test case with ServerAll privilege.

    $ source ./sentry-test/src/main/resources/sentry_env.sh clean ServerAll

How To Check Running Log

  • check sentry-test/src/test/log directory, all running logs will be generated in the directory dynamically.

About

hadoop sentry

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages